英文:
AWS Amplify Build Error - Mismatched Brackets Found In The Schema
问题
End Desire:
构建我的AWS Amplify项目在dev
环境中,使用全栈CI/CD。例如,将我的更改推送到Code Commit将构建后端资源。
Build Logs:
2023-01-06T06:19:26.457Z [INFO]: [33m注意:建议从您的应用程序目录的根目录运行此命令[39m
2023-01-06T06:19:27.797Z [WARNING]: - 初始化您的环境:dev
2023-01-06T06:19:29.164Z [WARNING]: - 构建资源api/project
2023-01-06T06:19:33.756Z [WARNING]: - 构建资源auth/project
2023-01-06T06:19:33.902Z [WARNING]: - 构建资源storage/project
2023-01-06T06:19:33.939Z [WARNING]: ✔ 成功初始化提供程序。
2023-01-06T06:19:34.452Z [WARNING]: ✖ 初始化您的环境时出现错误。
2023-01-06T06:19:34.453Z [INFO]: 🛑 语法错误:在模式中找到不匹配的括号。在模式中第239行发现了意外的)。
2023-01-06T06:19:34.453Z [INFO]: 了解更多信息:https://docs.amplify.aws/cli/project/troubleshooting/
buildspec.yml:
version: 0.1
frontend:
phases:
preBuild:
commands:
- npm i
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
Checks:
- 我已检查了
graphql.schema
中的错误。 - 我已删除了buildspec中的测试部分。
- 我已根据此处的建议添加了
amplify push --simple
。 - 我已成功在本地CLI上运行了
npm run build
。
英文:
End Desire:
To build my AWS Amplify project in the dev
environment, using full-stack CI/CD. So for example, pushing my changes to Code Commit will build the backend resources.
Build Logs:
2023-01-06T06:19:26.457Z [INFO]: [33mNote: It is recommended to run this command from the root of your app directory[39m
2023-01-06T06:19:27.797Z [WARNING]: - Initializing your environment: dev
2023-01-06T06:19:29.164Z [WARNING]: - Building resource api/project
2023-01-06T06:19:33.756Z [WARNING]: - Building resource auth/project
2023-01-06T06:19:33.902Z [WARNING]: - Building resource storage/project
2023-01-06T06:19:33.939Z [WARNING]: ✔ Initialized provider successfully.
2023-01-06T06:19:34.452Z [WARNING]: ✖ There was an error initializing your environment.
2023-01-06T06:19:34.453Z [INFO]: 🛑 Syntax Error: mismatched brackets found in the schema. Unexpected ) at line 239 in the schema.
2023-01-06T06:19:34.453Z [INFO]: Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/
buildspec.yml:
version: 0.1
frontend:
phases:
preBuild:
commands:
- npm i
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
Checks:
- I have checked the
graphql.schema
for errors. - I have removed the testing section in the buildspec.
- I have added
amplify push --simple
as recommended here - I've ran
npm run build
on my local CLI successfully
答案1
得分: 0
在AWS Amplify控制台中,在构建设置下,AWS CLI版本为"latest"。将AWS CLI版本更改为10.4.0
解决了该问题。
在此查看AWS CLI版本:https://www.npmjs.com/package/@aws-amplify/cli?activeTab=versions
不要选择10.4.0
,而是选择在最新AWS CLI版本发布之前的几个版本。
英文:
In the AWS Amplify console, under build settings, the AWS CLI version was "latest". Changing the AWS CLI version to 10.4.0
fixed the issue.
View AWS CLI Versioning here: https://www.npmjs.com/package/@aws-amplify/cli?activeTab=versions
Rather than going to 10.4.0
, go back a couple versions from the latest AWS CLI version at the time.
答案2
得分: 0
这可能与GitHub上的此问题相关。Amplify(意外地)解析了包含实际查询、变更和类型的GraphQL注释,并将其报告为语法错误。
根据GitHub问题,已在v10.6.2中修复。
英文:
This is probably related to this issue on GitHub. Amplify did (accidentally) parse GraphQL comments that contain actual queries, mutations and types and reported these as syntax error.
It has been fixed in v10.6.2 according to the GitHub issue.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论