Open dan-hook opened 1 year ago
I have the same issue. Also using amplify 10.7.0. I am on a Mac M1. Looks very similar to this issue that already got resolved in 9.0.0 couple months ago: https://github.com/aws-amplify/amplify-cli/issues/10578
Same issue on amplify 10.7.1. I am also on a Mac M1.
Hey @dan-hook :wave: thanks for raising this! Was the amplify/mock-data
directory deleted before mock finished initializing? Looking at this log item:
Mock DB deletion detected. Clearing the OpenSearch indices...
@raphipaffi @issakr on M1 macs you will need to install the 64-bit version of Java
For example, this is the Java version I am running locally on my M1 mac
➜ java -version
openjdk version "18.0.1.1" 2022-04-22
OpenJDK Runtime Environment (build 18.0.1.1+2-6)
OpenJDK 64-Bit Server VM (build 18.0.1.1+2-6, mixed mode, sharing)
I already use openjdk `➜ java -version
openjdk version "17.0.4.1" 2022-08-12 OpenJDK Runtime Environment Temurin-17.0.4.1+1 (build 17.0.4.1+1) OpenJDK 64-Bit Server VM Temurin-17.0.4.1+1 (build 17.0.4.1+1, mixed mode)`
Hey @dan-hook 👋 thanks for raising this! Was the
amplify/mock-data
directory deleted before mock finished initializing? Looking at this log item:Mock DB deletion detected. Clearing the OpenSearch indices...
I think that log item is spurious and may have even been caused by my computer going to sleep. There was 5-10 minutes between each "Re-Trying with a new shard". I stopped checking the Explorer after about six of them.
This is a complicated Amplify project and this is the first time I've tried running aws mock api on it. There were a number of issues such as VTL parsing errors that I needed to fix before I got this far, and I'm not surprised that there are still more issues. I'm not surprised it doesn't work, I just wish there was a better error message.
I already have Java 64bit installed
➜ route-planner git:(master) ✗ java -version openjdk version "19.0.2" 2023-01-17 OpenJDK Runtime Environment Homebrew (build 19.0.2) OpenJDK 64-Bit Server VM Homebrew (build 19.0.2, mixed mode, sharing)
Let me know if there is anything else I can try.
Hey @raphipaffi @issakr given the M1 issue is different than what this issue is describing, would y'all mind filing a separate bug report to track your issue separately? We want to be sure this is addressed and documentation is updated if necessary. Do you experience the same issue using the official distribution from the OpenJDK downloads page?
@dan-hook
This is a complicated Amplify project and this is the first time I've tried running aws mock api on it.
Would you be open to sharing your schema.graphql
? Do you have any overridden, slotted resolvers or custom resolvers that are causing the VTL parsing errors?
Upon further review of the error messaging I see the following error, are you using a Relational Database with your GraphQL API?
Data source of type RELATIONAL_DATABASE is not supported by local mocking. A NONE data source will be used.
I also started suffering this issue. I was trying on the 10.7.3 and 10.7.2 client builds. The following comment helped me resolve it for now: https://github.com/aws-amplify/amplify-cli/issues/10488#issuecomment-1434523750 - downgrade to 10.6.2 and it's working again.
@NicholasAllen thank you so much for that tip! That downgrade also "fixed" it for me.
Hey folks I'm able to reproduce this issue using the Todo schema. Marking as a bug
Hi, there is an ETA for the resolution of this bug?
@josefaidt. We are still experiencing this issue in 11.0.5. Any update on the fix?
FYI. Clearing mock files does not help. . I have @searchable annotations so I am unable to go back to 10.x.x
We are experiencing the same issue on 11.0.5.
@josefaidt @phani-srikar This issue still exists in 11.1.0.
I would love to have this addressed if possible. I cannot downgrade to 10.6.2 because I am using OpenSearch mocking, which is only available in 11.x.x. I realize this may not seem like a priority but as a longtime Amplify. user it's a huge disadvantage to not have this feature in API mocking.
Any updates?
@josefaidt @phani-srikar ... any updates on this bug? It has really slowed development to not be able to use the tools to test locally. I am commenting here because It has been so long and I would really love to get this bug addressed so I can be on an updated amplify version. I am still stuck on 10.6.2 just to be able to get this to work :(
Checking for any updates on this bug. Still exists in 12.1.0
Hey folks I'm able to reproduce this issue using the Todo schema. Marking as a bug
Hi Josef, are you able to resolve the bug or provide a walkaround? My team has been stuck here for too long, any help would be greatly appreciated!
Best regards!
@josefaidt Hi josefaidt.
Thank you for your response.
You have transfered this issue from amplify-cli repository to here. But the code has probrem is not in this repository. It is in amplify-cli repository. Please see my PR in amplify-cli repository.
amplify mock is very useful and important function for developers. A lot of developers are stuck in this bug for months. I would appreciate it if you could respond promptly.
Best regards,
I found that the error directly comes from adding Cognito User Pool auth to the api, no matter if API or IAM is also enabled. Working with amplify -v 12.0.0 since amplify mocks fail completely on m2 Mac using the latest version of the cli.
Im using -v 12.2.0 and seeing the same issues. I am seeing the following error in the console:
"Error: Error when generating OIDC token: Right-hand side of 'instanceof' is not an object"
This was working fine earlier today, not sure what changed recently.
Any updates ? Same issue with Amplify CLI version 12.3.0.
I have confirmed that it also occurs in v12.4.0.
Still occurs in v12.7.0.
It's been months and still not able to see anything on Amplify GraphiQL Explorer.
There is this Uncaught (in promise) Error: Error when generating OIDC token: invalid 'instanceof' operand g
error that everybody mentioned on my browser console.
Also, when I try to execute a query, I always get the unauthorized error:
{
"errors": [
{
"errorType": "UnauthorizedException",
"message": "UnauthorizedException: Missing authorization"
}
]
}
As mentioned by others developing and testing locally is very important and without it the development process is far slower. @josefaidt Are there any updates?
Hi everyone, this issue was opened almost 1 year ago. It is NOT a MINOR bug. There are teams around the world that are not able to use the latest version of Amplify just because of this problem. Could you help us, @josefaidt, @alharris-at ?
I would like to share my experience, maybe will help someone.
Yes, I'm having the same issue as everyone. But, given that I use nvm to control my node versions, I "manage" to deal with this problem installing different amplify-cli version on different node version as mentioned here.
nvm use 20
npm install npm install -g @aws-amplify
nvm use 18
npm install -g @aws-amplify/cli@10.6.2 // working version
Also, I do agree with @kmy90. It should not be treated as a minor thing.
Hey folks, this is a serious issue here impacting everyone and disrupting the development process. Using workarounds, like downgrading the Amplify version, isn't the most convenient solution. Personally, I struggled with testing my projects locally using the explorer, and it really bothered me that such an important issue had been left unattended for a year.
I fixed it by creating a PR (https://github.com/aws-amplify/amplify-cli/pull/13555). Can you please support it? We need the Amplify team to review and approve the fix. Thanks!
Still occurs in v12.10.1.
Fixed in version 12.11.0
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v18.14.0
Amplify CLI Version
10.7.0
What operating system are you using?
Ubuntu 22.04 on WSL2 on Windows 10
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
Yes, the changes are extensive.
Describe the bug
I ran apt-get install java-11-amazon-corretto-jdk to install Java.
Running amplify mock api launches Amplify GraphiQL Explore on localhost:20002, but it's empty saying "No Schema Available". The CLI output is: vscode ➜ .../panel-api/project/amplify/backend (features/VCD-504-ecv-api ✗) $ amplify mock api GraphQL schema compiled successfully.
Edit your schema at /workspaces/gene-panel-api/project/amplify/backend/api/genepanelapi/schema.graphql or place .graphql files in a directory at /workspaces/gene-panel-api/project/amplify/backend/api/genepanelapi/schema Mock does not handle CloudFormation resource of type AWS::IAM::ManagedPolicy. Skipping processing resource AuthRolePolicy01. Mock does not handle CloudFormation resource of type AWS::IAM::ManagedPolicy. Skipping processing resource AuthRolePolicy02. Mock does not handle CloudFormation resource of type AWS::IAM::ManagedPolicy. Skipping processing resource AuthRolePolicy03. Data source of type RELATIONAL_DATABASE is not supported by local mocking. A NONE data source will be used. Data source of type HTTP is not supported by local mocking. A NONE data source will be used. Data source of type HTTP is not supported by local mocking. A NONE data source will be used. Data source of type HTTP is not supported by local mocking. A NONE data source will be used. Could not find ref for "RdsPanelDbName". Using unsubstituted value. Could not find ref for "RdsPanelDbName". Using unsubstituted value. Running GraphQL codegen ✔ Generated GraphQL operations successfully and saved at ../../src/graphql AppSync Mock endpoint is running at http://172.17.0.2:20002 Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Re-Trying with a new shard Mock DB deletion detected. Clearing the OpenSearch indices... Re-Trying with a new shard Re-Trying with a new shard Failed to start API Mocking. Running cleanup tasks. MockProcessFault: Failed to start API Mocking.. Reason: null at APITest.start (/snapshot/repo/build/node_modules/amplify-util-mock/lib/api/api.js:151:13) at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async start (/snapshot/repo/build/node_modules/amplify-util-mock/lib/api/index.js:18:5)
at async Object.run (/snapshot/repo/build/node_modules/amplify-util-mock/lib/commands/mock/api.js:21:5)
at async Object.executeAmplifyCommand (/snapshot/repo/build/node_modules/amplify-util-mock/lib/amplify-plugin-index.js:47:3)
at async executePluginModuleCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:142:5)
at async executeCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:40:9)
at async Object.run (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/index.js:117:5) {
classification: 'FAULT',
options: {
message: 'Failed to start API Mocking.. Reason: null',
link: 'https://docs.amplify.aws/cli/graphql/troubleshooting/'
},
downstreamException: undefined,
toObject: [Function (anonymous)],
details: undefined,
resolution: undefined,
code: undefined,
link: 'https://docs.amplify.aws/cli/graphql/troubleshooting/'
}
Expected behavior
I expected to see the API in the explorer.
Reproduction steps
Run 'amplify mock api'
Project Identifier
9c19ea5526c1afd0a3e1987ea44f96af
Log output
Additional information
No response
Before submitting, please confirm: