Open jo2 opened 1 year ago
Hey @jo2 :wave: thanks for raising this! I'm going to transfer this over to our API repo for better assistance with the VTL resolvers
Hey @jo2, Thank you for rasing this issue. By following the steps mentioned in the description, we were able to replicate the problem. Hence, we have classified this as a bug for the team to investigate and assess.
I'm experiencing the same issue for our repo. @jo2 Did you find a workaround?
I didn't find a workaround yet. I'm still waiting for a fix.
Until this issue is resolved, downgrading the CLI to version 12.0.0 and using OpenJDK version 16.0.1 (assuming if on Apple Silicon) could be a potential workaround. ref: Stackoverflow
Using Amplify 12.0.0 it seems to be working fine:
$ amplify mock api
✅ GraphQL schema compiled successfully.
Edit your schema at F:\git\BookStore-Amplify\amplify\backend\api\adessobookstore\schema.graphql or place .graphql files in a directory at F:\git\BookStore-Amplify\amplify\backend\api\adessobookstore\schema
Creating new table AuthorTable
Creating new table BookTable
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Running GraphQL codegen
√ Generated GraphQL operations successfully and saved at src\graphql
√ Code generated successfully and saved in file src\API.ts
AppSync Mock endpoint is running at http://192.168.178.32:20002
doesn't seem to depend on the java version though, it worked with Java 8, and Java 17, I didn't try it with other Java versions. Downgrading to Amplify 12.0.0 is a valid workaround for now.
Should this issue remain open to track this bug? Otherwise it can be closed.
Hi all involved here. I've got the same error with version 12.1.1 All the resolvers for the sync operation have the same issue.
Digging a little here found that the issue can be resolved by overwriting the resolver into the api/#foreach( $filterItem in $ctx.stash.authFilter.or )
to #foreach( $filterItem in $ctx.stash.authFilter.get('or') )
Seems that the new version (12.1.1) uses a newest Apache velocity template that the old one and the new version takes the "or" as the operator instead of the property. Found the solution on https://stackoverflow.com/questions/72261787/escape-lower-than-lt-greater-than-gt-operators-text-version-velocity-templat
Still, I haven't found the place where this templates get generated to send a PR.
Hi all, I still see this issue on amplify cli version 12.2.3. I'm on Apple silicon chip. Downgrading the java version to 16.0.1 from 20.0.2 didn't seem to have done anything.
I've downgraded the CLI to 12.0.0 as suggested and it works fine for now. 👍
I also had this problem. I had the same error from an Amplify-generated VTL template that we did not modify, with an "or" in it. I was using 12.2.0 of the Amplify CLI.
Downgrading to 12.0.0 made it work.
Please fix that so that we can use the current Amplify CLI version.
We've been bitten by this bug as well, today. We're kinda stuck :-\
Downgrading to 12.0.0 allows the mock command to complete. But it seems that the graphql schema is not loaded correctly into GraphiQL.
Yeah @ethanhinson We have the same issue as well. Although it doesn't crash for 12.0.0, our GrpahiQL is completely empty after running the mock
I followed the lead of @esteban-serfe and copied the offending resolvers vtl templates over and did the find and replace. That does indeed allow the mock server to start. However, the GraphQL schema is still not loaded by GraphiQL.
I'm also facing the issue that there is no schema in amplify mock using version 12.0.0. Using 12.5.1 as the newest version, I still get the error that I get the parse error.
Having the same error after upgrading amplify. amplify mock wont work with the following error for all resolvers.
Reason: Error:Parse error on resolvers/Query.syncExamplr.req.vtl:11:50
Parse error on line 12:
...tx.stash.authFilter.or ) #if( $fil
-----------------------^
Expecting 'ID', 'CONTENT', got '||'
But this does not only seem to accept mock. i cant push either.
@AnilMaktala any updates on this. this has been stale for quite a while. And the only way to get it to work is downgrading... Which in case is breaking my custom build scripts.
any update on this. I have latest amplify cli version 12.10.1.. still it shows the same issue
Failed to start API Mocking. Running cleanup tasks.
Reason: Error:Parse error on resolvers/Query.syncUsers.req.vtl:11:50
Parse error on line 12:
...tx.stash.authFilter.or ) #if( $fil
-----------------------^
Expecting 'ID', 'CONTENT', got '||'
any update here? I am on 12.12.2 but still same problem for my flutter project: Failed to start API Mocking. Running cleanup tasks. Reason: Error:Parse error on resolvers/Query.syncFlashcards.req.vtl:11:50 Parse error on line 12: ...tx.stash.authFilter.or ) #if( $fil -----------------------^ Expecting 'ID', 'CONTENT', got '||'
Friendly ping for update :) I use amplify cli 12.12.3 and also got the same issue when running amplify mock api
Failed to start API Mocking. Running cleanup tasks.
Reason: Error:Parse error on resolvers/Query.syncExperiences.req.vtl:11:50
Parse error on line 12:
...tx.stash.authFilter.or ) #if( $fil
-----------------------^
Expecting 'ID', 'CONTENT', got '||'
[update]: downgrading to 12.0.0 perfectly solve the problem
Getting this as well. My versions:
`❯ aws --version aws-cli/2.15.25 Python/3.11.8 Darwin/23.5.0 exe/x86_64 prompt/off
❯ java --version openjdk 22.0.2 2024-07-16 OpenJDK Runtime Environment Homebrew (build 22.0.2) OpenJDK 64-Bit Server VM Homebrew (build 22.0.2, mixed mode, sharing)
❯ amplify --version 12.12.6
❯ uname -a Darwin Serenity.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:19:05 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8112 arm64 `
How did you install the Amplify CLI?
npm install -g @aws-amplify/cli
If applicable, what version of Node.js are you using?
18.16.0
Amplify CLI Version
12.1.1
What operating system are you using?
Windows 10
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
Describe the bug
When running
amplify mock api
I get the following console output:Expected behavior
I expect
amplify mock api
to start up a mock environment of the backend api.Reproduction steps
amplify init
amplify mock api
Project Identifier
345e114ba9485c7429ea7f372fe4e78b
Log output
Additional information
No response
Before submitting, please confirm: