-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
amplify mock not setting API_*_GRAPHQLAPIENDPOINTOUTPUT env var correctly in lambda resolver #6548
Comments
@hisham So you have a Lambda resolver as a part of your schema which is calling the GraphQL endpoint as well? |
Yes that's correct. Ok I'll try your suggestion next time I use amplify mock. |
@kaustavghosh06 running the following does not work:
It seems the amplify mock code overrides it with the incorrect url. I would have to set this env var in the lambda code instead, and then remove it when I do amplify push. Is there a way within lambda to know if it's in a mock environment? I see you set ENV to NONE and REGION to us-east-1-fake, and I can check other things in the env, but I wonder if there's an official way. |
A fix for this has been released in version 4.44.1 of the CLI. Please upgrade to the latest version to try it out. |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Describe the bug
I have a graphql lambda resolver that as part of its processing does a create mutation via the same graphql API.
I am currently testing this lambda resolver via amplify mock. Everything works until the lambda attempts to do a graphql mutation.
The error I get is the following:
Looking at the url above, it is supposed to be http://192.168.86.25:20002 since I am running amplify mock, but instead it's my actual non-mock aws appsync endpoint. It does not appear that amplify mock sets the API...GRAPHQLAPIENDPOINTOUTPUT env var correctly.
Amplify CLI Version
4.41.2
To Reproduce
Create a lambda resolver that in turn calls the same graphql api with a mutation or query, and test via amplify mock.
The text was updated successfully, but these errors were encountered: