Open AustinAmoruso opened 2 years ago
Hey @AustinAmoruso :wave: thanks for raising this! Would you mind sharing your GraphQL Schema and configuration of your GraphQL API? I was not able to reproduce this issue with the sample Todo schema.
This also happens on v7.6.21 and for another dev on my team as well. Where can we send the schema to?
I have had the same issue. I have started commenting out custom queries/mutations/subscriptions and found that one mutation with a lambda resolver attached was causing the error. After a successful run of
I have found that I had a couple of generated VTL templates for the mutation with the lambda resolver attached. Deleting the req/res VTL templates resolve the issueamplify mock api
I removed the comment from the commented mutation and it is working now
Also My current schema is all v1. I'm in the process of upgrading to v2.
+1 Amplify CLI has been broken for us with this issue after v7.6.19. Also on v1.
Same thing. Appears to be a bug in v20 onwards. Yesterday it was working fine (v21) and today it halts with this error. In attempt to mitigate it, I upgraded to v24 but it persists. I had to downgrade to v19 in order to get it working again.
Hey @AustinAmoruso and folks in the thread :wave: apologies for the delay here! Please send your schema to amplify-cli@amazon.com, and it appears folks that are affected are using v1 schemas based on the replies here. I will try to reproduce this using transformer v1
Hey @AustinAmoruso :wave: thank you for sending your schema over 🙂 I commented out the @function
notes to see if it was unrelated and was not able to reproduce using Amplify CLI 7.6.26 on both macOS and Windows, can you confirm whether to continue to experience this after removing the custom Query and Mutation types? I also confirmed the @function() @auth()
usage did not impact mock.
As a few follow-up questions:
~/.amplify/logs
at the time the error occurred?@josefaidt I am still getting the issue on mac on Amplify CLI 7.6.26. I sent over more information in an email.
Hey @AustinAmoruso thank you for sending that over 🙂 I'm able to reproduce the issue and am taking a further look
Hey @AustinAmoruso :wave: I've been able to narrow this issue down to this condition, where userOverriddenSlots
is undefined
rather than an array of strings: https://github.com/aws-amplify/amplify-cli/blob/master/packages/amplify-util-mock/src/api/resolver-overrides.ts#L55 and https://github.com/aws-amplify/amplify-cli/blob/master/packages/amplify-util-mock/src/api/api.ts#L95
Marking this as a bug 🙂
Seeing the same issue here with v1 - on 8.0.2.
Seeing this issue as well, using v1 on v8.0.2
I am having the same issue, with graphql v2 on amplify 8.0.2
still persists upon updating to amplify 8.1.0
I downgraded to npm install -g @aws-amplify/cli@7.6.19
and it seems to work for now, node v16.13.2
Hey @AustinAmoruso 👋 I've been able to narrow this issue down to this condition, where
userOverriddenSlots
isundefined
rather than an array of strings: https://github.com/aws-amplify/amplify-cli/blob/master/packages/amplify-util-mock/src/api/resolver-overrides.ts#L55 and https://github.com/aws-amplify/amplify-cli/blob/master/packages/amplify-util-mock/src/api/api.ts#L95Marking this as a bug 🙂
Is there any head way on this I'm still unable to upgrade my cli.
@josefaidt @alharris-at We're still seeing this bug on v9.0.0
, which appears to be the one thing preventing us from upgrading v7.6.19
Hello, any updates on this?
I'm still having troubles with this too, I need to revert my amplify cli version to 7.6.19
every time I want to run the mock API 😞
same issue here :(
Is this maybe resolved in version 10.0.0
released a couple of days ago?
This is still very much a problem even on the newest version of cli 10.4.0. I'll send the reports via email that I just got from the newest cli.
This suddenly started hapenning now in 10.5.0
as well as 10.0.0
, node version v14.19.1
or even with v19.2.0
Is there a timeline to fix this, please?
If I downgrade, my entire project is broken. Is there a workaround? Is there someplace in my project that I can put an empty array that will fix this? I'm currently blocked.
If I downgrade, my entire project is broken. Is there a workaround? Is there someplace in my project that I can put an empty array that will fix this? I'm currently blocked.
@mkane91301 we use the following workaround in our project: we nave two nvm environments and we switch between them. So we use the newer one (v8.4.0) to do the changes to our amplify environments (e.g. amplify push) and the old one (7.6.19 - the latest version that doesn't have this bug) to start the amplify mock. After amplify mock is started it overrides the API.ts, mutations, queries, etc and I believe that is what breaks your project. But we simply discard those changes and after that we start our app that points to the mock GraphQL server that was started by an older amplify. With that discard we essentially have a project generated by the new version and the mock server run by the old amplify version.
Of course it is just a workaround and we would really appreciate if the bug would be fixed and we could get rid of this complicated test run setup ❤️
Some details about how to setup two separate amplify environments and quickly switch between them. Prerequisite: make sure you don't have a global node installation, otherwise amplify global installation will end up there instead of the selected environment. Install nvm
nvm install 14.18.3
npm install -g @aws-amplify/cli@7.6.19
nvm install 14.19.3
npm install -g @aws-amplify/cli@8.4.0
Now you can quickly switch:
nvm use 14.18.3
# Now using node v14.18.3 (npm v6.14.15)
amplify --version
# 7.6.26
nvm use 14
# Now using node v14.19.3 (npm v6.14.17)
amplify --version
# 8.4.0
This is even more bizarre that I have two projects with the same versions of all major libraries, and it works for one, not for the other. The package.json files are identical, there is the error even if I copy the node_modules
in the non-working project.
Still a problem in the latest version. Just downgraded back to 7.6.19...
amplify/cli 10.6.2 node 18
@josefaidt Is there a timeline to resolve this, please? In two weeks, this issue will have a birthday. 🎂
Facing the same issue here :/// Seems like people at AWS are more worried about their jobs then their customer's issues.
@josefaidt same question, is there a timeline for when this issue will be fixed? Thanks! We still have to use version 7.6.19 when we want to run tests and create a lot of workarounds for this issue.
Before opening, please confirm:
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v12.22.10
Amplify CLI Version
7.6.20
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
none
Amplify Categories
function, api
Amplify Commands
Not applicable
Describe the bug
Running
amplify mock api --timeout 30
Cause the following errorFailed to start API Mock endpoint TypeError: Cannot read property 'includes' of undefined
while rolling back to cli version 7.6.19 does not cause the issue.Expected behavior
Mock should work
Reproduction steps
GraphQL schema(s)
Log output
Additional information
No response