使用 Amplify CI/CD 管道更新 AppSync API 时出错,AppSync API 密钥已过期:未找到 API 密钥
Error when updating AppSync API using Amplify CI/CD Pipelines with expired AppSync API KEY: API key not found
我们有 AWS Amplify 项目启用了 CI/CD 并且 AppSync 作为 API 为我的后端启用。 CI/CD 工作正常,直到 API_KEY 的 AppSync 应用程序没有过期,现在它已经过期并且管道是失败。我已尝试手动更新 API_KEY 过期时间,但管道仍然失败。描述了解决 manually or upgrade Amplify CLI 版本的解决方案,但在我的情况下似乎没有这两种选择。
我们还有第三种选择吗?
以下是来自构建管道的日志。
2021-09-20T08:26:55.643Z [INFO]: UPDATE_IN_PROGRESS amplify-smsservice-test-115827-apiSmsTest-QXTZ5RMZXWPI AWS::CloudFormation::Stack Mon Sep 20 2021 08:26:55 GMT+0000 (Coordinated Universal Time) User Initiated
2021-09-20T08:27:05.585Z [INFO]:
2021-09-20T08:27:05.588Z [INFO]: UPDATE_IN_PROGRESS GraphQLSchema AWS::AppSync::GraphQLSchema Mon Sep 20 2021 08:27:01 GMT+0000 (Coordinated Universal Time)
UPDATE_IN_PROGRESS GraphQLAPIKey AWS::AppSync::ApiKey Mon Sep 20 2021 08:27:01 GMT+0000 (Coordinated Universal Time)
UPDATE_FAILED GraphQLAPIKey AWS::AppSync::ApiKey Mon Sep 20 2021 08:27:03 GMT+0000 (Coordinated Universal Time) API key not found: da2-rtqcdxh23bdrneqr746znw4e7i (Service: AWSAppSync; Status Code: 404; Error Code: NotFoundException; Request ID: 774ee2b5-340d-4e81-8f6d-346a040ee275; Proxy: null)
UPDATE_FAILED GraphQLSchema AWS::AppSync::GraphQLSchema Mon Sep 20 2021 08:27:04 GMT+0000 (Coordinated Universal Time) Resource update cancelled
UPDATE_ROLLBACK_IN_PROGRESS amplify-smsservice-test-115827-apiSmsTest-QXTZ5RMZXWPI AWS::CloudFormation::Stack Mon Sep 20 2021 08:27:05 GMT+0000 (Coordinated Universal Time) The following resource(s) failed to update: [GraphQLAPIKey, GraphQLSchema].
2021-09-20T08:27:10.509Z [INFO]:
2021-09-20T08:27:10.510Z [INFO]: UPDATE_FAILED apiSmsTest AWS::CloudFormation::Stack Mon Sep 20 2021 08:27:06 GMT+0000 (Coordinated Universal Time) Embedded stack arn:aws:cloudformation:us-west-2:331375544915:stack/amplify-smsservice-test-115827-apiSmsTest-QXTZ5RMZXWPI/034ec0e0-0b1e-11ec-a9e0-0affe2668681 was not successfully updated. Currently in UPDATE_ROLLBACK_IN_PROGRESS with reason: The following resource(s) failed to update: [GraphQLAPIKey, GraphQLSchema].
UPDATE_ROLLBACK_IN_PROGRESS amplify-smsservice-test-115827 AWS::CloudFormation::Stack Mon Sep 20 2021 08:27:06 GMT+0000 (Coordinated Universal Time) The following resource(s) failed to update: [apiSmsTest].
2021-09-20T08:27:35.515Z [INFO]:
2021-09-20T08:27:35.517Z [INFO]: UPDATE_IN_PROGRESS apiSmsTest AWS::CloudFormation::Stack Mon Sep 20 2021 08:27:31 GMT+0000 (Coordinated Universal Time)
2021-09-20T08:28:05.623Z [INFO]:
2021-09-20T08:28:05.624Z [INFO]: UPDATE_IN_PROGRESS GraphQLSchema AWS::AppSync::GraphQLSchema Mon Sep 20 2021 08:28:01 GMT+0000 (Coordinated Universal Time)
UPDATE_COMPLETE GraphQLAPIKey AWS::AppSync::ApiKey Mon Sep 20 2021 08:28:01 GMT+0000 (Coordinated Universal Time)
2021-09-20T08:29:05.663Z [INFO]:
2021-09-20T08:29:05.665Z [INFO]: UPDATE_COMPLETE GraphQLSchema AWS::AppSync::GraphQLSchema Mon Sep 20 2021 08:29:04 GMT+0000 (Coordinated Universal Time)
2021-09-20T08:29:10.664Z [INFO]:
2021-09-20T08:29:10.665Z [INFO]: UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS amplify-smsservice-test-115827-apiSmsTest-QXTZ5RMZXWPI AWS::CloudFormation::Stack Mon Sep 20 2021 08:29:06 GMT+0000 (Coordinated Universal Time)
2021-09-20T08:29:30.596Z [INFO]:
2021-09-20T08:29:30.598Z [INFO]: UPDATE_COMPLETE apiSmsTest AWS::CloudFormation::Stack Mon Sep 20 2021 08:29:25 GMT+0000 (Coordinated Universal Time)
UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS amplify-smsservice-test-115827 AWS::CloudFormation::Stack Mon Sep 20 2021 08:29:26 GMT+0000 (Coordinated Universal Time)
2021-09-20T08:29:40.606Z [INFO]:
2021-09-20T08:29:40.607Z [INFO]: UPDATE_COMPLETE apiSmsTest AWS::CloudFormation::Stack Mon Sep 20 2021 08:29:37 GMT+0000 (Coordinated Universal Time)
UPDATE_ROLLBACK_COMPLETE amplify-smsservice-test-115827 AWS::CloudFormation::Stack Mon Sep 20 2021 08:29:38 GMT+0000 (Coordinated Universal Time)
2021-09-20T08:29:55.851Z [INFO]: Following resources failed
Resource Name: ilwhx4plcrdbtcnaapvtb6ilpqGraphQLSchema (AWS::AppSync::GraphQLSchema)
Event Type: update
Reason: Resource update cancelled
URL: https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/arn%3Aaws%3Acloudformation%3Aus-west-2%3A331375544915%3Astack%2Famplify-smsservice-test-115827-apiSmsTest-QXTZ5RMZXWPI%2F034ec0e0-0b1e-11ec-a9e0-0affe2668681/events
2021-09-20T08:29:55.852Z [INFO]: Resource Name: arn:aws:appsync:us-west-2:331375544915:apis/ilwhx4plcrdbtcnaapvtb6ilpq/apikeys/da2-rtqcdxh23bdrneqr746znw4e7i (AWS::AppSync::ApiKey)
Event Type: update
Reason: API key not found: da2-rtqcdxh23bdrneqr746znw4e7i (Service: AWSAppSync; Status Code: 404; Error Code: NotFoundException; Request ID: 774ee2b5-340d-4e81-8f6d-346a040ee275; Proxy: null)
URL: https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/arn%3Aaws%3Acloudformation%3Aus-west-2%3A331375544915%3Astack%2Famplify-smsservice-test-115827-apiSmsTest-QXTZ5RMZXWPI%2F034ec0e0-0b1e-11ec-a9e0-0affe2668681/events
2021-09-20T08:29:55.852Z [WARNING]: ✖ An error occurred when pushing the resources to the cloud
✖ There was an error initializing your environment.
2021-09-20T08:29:55.860Z [INFO]: [0mResourceNotReady: Resource is not in the state stackUpdateComplete[0m
[0m at constructor.setError (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/resource_waiter.js:182:47)[0m
[0m at Request.CHECK_ACCEPTORS (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/resource_waiter.js:44:12)[0m
[0m at Request.callListeners (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:106:20)[0m
[0m at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)[0m
[0m at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:688:14)[0m
[0m at Request.transition (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)[0m
[0m at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)[0m
[0m at /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10[0m
[0m at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)[0m
[0m at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:690:12)[0m
[0m at Request.callListeners (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)[0m
[0m at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)[0m
[0m at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:688:14)[0m
[0m at Request.transition (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)[0m
[0m at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)[0m
[0m at /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10[0m
[0m at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)[0m
[0m at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:690:12)[0m
[0m at Request.callListeners (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)[0m
[0m at callNextListener (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:96:12)[0m
[0m at IncomingMessage.onEnd (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/event_listeners.js:336:13)[0m
[0m at IncomingMessage.emit (events.js:326:22)[0m
[0m at IncomingMessage.EventEmitter.emit (domain.js:483:12)[0m
[0m at endReadableNT (_stream_readable.js:1241:12)[0m
[0m at processTicksAndRejections (internal/process/task_queues.js:84:21) {[0m
[0m code: 'ResourceNotReady',[0m
[0m retryable: false,[0m
[0m time: 2021-09-20T08:29:50.845Z,[0m
[0m statusCode: 200,[0m
[0m retryDelay: 30000[0m
[0m}[0m
将 "CreateAPIKey": 0
添加到 parametes.json
后解决了我的问题。
我们有 AWS Amplify 项目启用了 CI/CD 并且 AppSync 作为 API 为我的后端启用。 CI/CD 工作正常,直到 API_KEY 的 AppSync 应用程序没有过期,现在它已经过期并且管道是失败。我已尝试手动更新 API_KEY 过期时间,但管道仍然失败。描述了解决 manually or upgrade Amplify CLI 版本的解决方案,但在我的情况下似乎没有这两种选择。
我们还有第三种选择吗?
以下是来自构建管道的日志。
2021-09-20T08:26:55.643Z [INFO]: UPDATE_IN_PROGRESS amplify-smsservice-test-115827-apiSmsTest-QXTZ5RMZXWPI AWS::CloudFormation::Stack Mon Sep 20 2021 08:26:55 GMT+0000 (Coordinated Universal Time) User Initiated
2021-09-20T08:27:05.585Z [INFO]:
2021-09-20T08:27:05.588Z [INFO]: UPDATE_IN_PROGRESS GraphQLSchema AWS::AppSync::GraphQLSchema Mon Sep 20 2021 08:27:01 GMT+0000 (Coordinated Universal Time)
UPDATE_IN_PROGRESS GraphQLAPIKey AWS::AppSync::ApiKey Mon Sep 20 2021 08:27:01 GMT+0000 (Coordinated Universal Time)
UPDATE_FAILED GraphQLAPIKey AWS::AppSync::ApiKey Mon Sep 20 2021 08:27:03 GMT+0000 (Coordinated Universal Time) API key not found: da2-rtqcdxh23bdrneqr746znw4e7i (Service: AWSAppSync; Status Code: 404; Error Code: NotFoundException; Request ID: 774ee2b5-340d-4e81-8f6d-346a040ee275; Proxy: null)
UPDATE_FAILED GraphQLSchema AWS::AppSync::GraphQLSchema Mon Sep 20 2021 08:27:04 GMT+0000 (Coordinated Universal Time) Resource update cancelled
UPDATE_ROLLBACK_IN_PROGRESS amplify-smsservice-test-115827-apiSmsTest-QXTZ5RMZXWPI AWS::CloudFormation::Stack Mon Sep 20 2021 08:27:05 GMT+0000 (Coordinated Universal Time) The following resource(s) failed to update: [GraphQLAPIKey, GraphQLSchema].
2021-09-20T08:27:10.509Z [INFO]:
2021-09-20T08:27:10.510Z [INFO]: UPDATE_FAILED apiSmsTest AWS::CloudFormation::Stack Mon Sep 20 2021 08:27:06 GMT+0000 (Coordinated Universal Time) Embedded stack arn:aws:cloudformation:us-west-2:331375544915:stack/amplify-smsservice-test-115827-apiSmsTest-QXTZ5RMZXWPI/034ec0e0-0b1e-11ec-a9e0-0affe2668681 was not successfully updated. Currently in UPDATE_ROLLBACK_IN_PROGRESS with reason: The following resource(s) failed to update: [GraphQLAPIKey, GraphQLSchema].
UPDATE_ROLLBACK_IN_PROGRESS amplify-smsservice-test-115827 AWS::CloudFormation::Stack Mon Sep 20 2021 08:27:06 GMT+0000 (Coordinated Universal Time) The following resource(s) failed to update: [apiSmsTest].
2021-09-20T08:27:35.515Z [INFO]:
2021-09-20T08:27:35.517Z [INFO]: UPDATE_IN_PROGRESS apiSmsTest AWS::CloudFormation::Stack Mon Sep 20 2021 08:27:31 GMT+0000 (Coordinated Universal Time)
2021-09-20T08:28:05.623Z [INFO]:
2021-09-20T08:28:05.624Z [INFO]: UPDATE_IN_PROGRESS GraphQLSchema AWS::AppSync::GraphQLSchema Mon Sep 20 2021 08:28:01 GMT+0000 (Coordinated Universal Time)
UPDATE_COMPLETE GraphQLAPIKey AWS::AppSync::ApiKey Mon Sep 20 2021 08:28:01 GMT+0000 (Coordinated Universal Time)
2021-09-20T08:29:05.663Z [INFO]:
2021-09-20T08:29:05.665Z [INFO]: UPDATE_COMPLETE GraphQLSchema AWS::AppSync::GraphQLSchema Mon Sep 20 2021 08:29:04 GMT+0000 (Coordinated Universal Time)
2021-09-20T08:29:10.664Z [INFO]:
2021-09-20T08:29:10.665Z [INFO]: UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS amplify-smsservice-test-115827-apiSmsTest-QXTZ5RMZXWPI AWS::CloudFormation::Stack Mon Sep 20 2021 08:29:06 GMT+0000 (Coordinated Universal Time)
2021-09-20T08:29:30.596Z [INFO]:
2021-09-20T08:29:30.598Z [INFO]: UPDATE_COMPLETE apiSmsTest AWS::CloudFormation::Stack Mon Sep 20 2021 08:29:25 GMT+0000 (Coordinated Universal Time)
UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS amplify-smsservice-test-115827 AWS::CloudFormation::Stack Mon Sep 20 2021 08:29:26 GMT+0000 (Coordinated Universal Time)
2021-09-20T08:29:40.606Z [INFO]:
2021-09-20T08:29:40.607Z [INFO]: UPDATE_COMPLETE apiSmsTest AWS::CloudFormation::Stack Mon Sep 20 2021 08:29:37 GMT+0000 (Coordinated Universal Time)
UPDATE_ROLLBACK_COMPLETE amplify-smsservice-test-115827 AWS::CloudFormation::Stack Mon Sep 20 2021 08:29:38 GMT+0000 (Coordinated Universal Time)
2021-09-20T08:29:55.851Z [INFO]: Following resources failed
Resource Name: ilwhx4plcrdbtcnaapvtb6ilpqGraphQLSchema (AWS::AppSync::GraphQLSchema)
Event Type: update
Reason: Resource update cancelled
URL: https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/arn%3Aaws%3Acloudformation%3Aus-west-2%3A331375544915%3Astack%2Famplify-smsservice-test-115827-apiSmsTest-QXTZ5RMZXWPI%2F034ec0e0-0b1e-11ec-a9e0-0affe2668681/events
2021-09-20T08:29:55.852Z [INFO]: Resource Name: arn:aws:appsync:us-west-2:331375544915:apis/ilwhx4plcrdbtcnaapvtb6ilpq/apikeys/da2-rtqcdxh23bdrneqr746znw4e7i (AWS::AppSync::ApiKey)
Event Type: update
Reason: API key not found: da2-rtqcdxh23bdrneqr746znw4e7i (Service: AWSAppSync; Status Code: 404; Error Code: NotFoundException; Request ID: 774ee2b5-340d-4e81-8f6d-346a040ee275; Proxy: null)
URL: https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/arn%3Aaws%3Acloudformation%3Aus-west-2%3A331375544915%3Astack%2Famplify-smsservice-test-115827-apiSmsTest-QXTZ5RMZXWPI%2F034ec0e0-0b1e-11ec-a9e0-0affe2668681/events
2021-09-20T08:29:55.852Z [WARNING]: ✖ An error occurred when pushing the resources to the cloud
✖ There was an error initializing your environment.
2021-09-20T08:29:55.860Z [INFO]: [0mResourceNotReady: Resource is not in the state stackUpdateComplete[0m
[0m at constructor.setError (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/resource_waiter.js:182:47)[0m
[0m at Request.CHECK_ACCEPTORS (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/resource_waiter.js:44:12)[0m
[0m at Request.callListeners (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:106:20)[0m
[0m at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)[0m
[0m at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:688:14)[0m
[0m at Request.transition (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)[0m
[0m at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)[0m
[0m at /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10[0m
[0m at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)[0m
[0m at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:690:12)[0m
[0m at Request.callListeners (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)[0m
[0m at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)[0m
[0m at Request.emit (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:688:14)[0m
[0m at Request.transition (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)[0m
[0m at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)[0m
[0m at /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10[0m
[0m at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)[0m
[0m at Request.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:690:12)[0m
[0m at Request.callListeners (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)[0m
[0m at callNextListener (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:96:12)[0m
[0m at IncomingMessage.onEnd (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/event_listeners.js:336:13)[0m
[0m at IncomingMessage.emit (events.js:326:22)[0m
[0m at IncomingMessage.EventEmitter.emit (domain.js:483:12)[0m
[0m at endReadableNT (_stream_readable.js:1241:12)[0m
[0m at processTicksAndRejections (internal/process/task_queues.js:84:21) {[0m
[0m code: 'ResourceNotReady',[0m
[0m retryable: false,[0m
[0m time: 2021-09-20T08:29:50.845Z,[0m
[0m statusCode: 200,[0m
[0m retryDelay: 30000[0m
[0m}[0m
将 "CreateAPIKey": 0
添加到 parametes.json
后解决了我的问题。