Closed Just-Drue closed 2 years ago
For an awful workaround, try adding await new Promise(resolve => setTimeout(resolve, 15000))
BEFORE this line: https://github.com/awslabs/aws-api-gateway-developer-portal/blob/cd1ea9451d4ed1cfbe6719f26f7f941f6a8285e9/lambdas/cloudfront-security/replicator.js#L67
Deployment succeeded, unsure of any unforeseen consequences.
Exact same problem here while deploying in sa-east-1.
Same problem in eu-west-1
Same problem in eu-north-1. The same code I'm using used to work in March 2021. I believe this is related to an update on July 2021:
Pending – After Lambda creates the function, it sets the state to pending. While in pending state, Lambda attempts to create or configure resources for the function, such as VPC or EFS resources. Lambda does not invoke a function during pending state. Any invocations or other API actions that operate on the function will fail. Source: https://docs.aws.amazon.com/lambda/latest/dg/functions-states.html
The following worked for me too. Thx @mklint !
For an awful workaround, try adding
await new Promise(resolve => setTimeout(resolve, 15000))
BEFORE this line:
same issue here us-east-1
The suggest workaround to add a timer does not fix the problem for me however. Perhaps I am not doing something correctly.
Thanks for reporting this. The update we had around Lambda Function States caused this issue. We need to wait for the newly created/updated function to be Active
before doing any operations with it, like publishing. Since this is an async call, the workaround mentioned here would help if the time was enough, thanks for the help!
This issue was fixed and the code merged with this PR, by adding waiter
functions until the correct state was set.
Still getting the same error, how to fix it?
showing below detail in cloudwatch
2021-12-22T16:49:09.013Z 0a057525-6742-4f25-8c95-1d78068e705d ERROR Error occurred: ResourceConflictException: The operation cannot be performed at this time. The resource arn:aws:lambda:us-east-1:837769957138:function:serverlessrepo-agdp-CloudFormationEdgeLambda-V0ryMWIW7oGj is currently in the following state: 'Pending'. StateReasonCode: 'Creating'
at Object.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/json.js:52:27)
at Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/rest_json.js:55:8)
at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:688:14)
at Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.
When deploying it fails at
CloudFrontSecurityHeadersSetup
step and unsure why.Looked through open and closed issues but haven't found any similar tickets. Tried in multiple regions (
us-west-1
andeu-west-1
)EDIT: Tried downloading repo and following this guide but the result is the same. EDIT#2: Downgrading to 4.0.4 didn't solve it as well. EDIT#3: Following this guide and setting everything to
us-east-1
doesn't help as well.