Unresolved resource dependencies on serverless deploy when there is a http handler

Viewed 20

hope you're all good, I keep getting this error when using sls deploy with runtime node16x:

npx sls deploy  --stage dev --alias iteration01

Deploying my-service to stage dev (us-east-1)

Packaging
Adding build information (0.18.0-63aef72)
Adding branch information (features/iteration01)
Excluding development dependencies for service package
Retrieving CloudFormation stack
Preparing alias ...
Processing custom resources
Removing resources:
Processing functions
Processing API
Configuring stage
Processing event source subscriptions
Processing SNS Lambda subscriptions
Adding deployment date information
Uploading
Uploading CloudFormation file to S3
Uploading State file to S3
Uploading service my-service.zip file to S3 (16.59 MB)

āœ– Stack my-service-dev failed to deploy (62s)
Environment: darwin, node 16.17.0, framework 3.18.2 (local), plugin 6.2.2, SDK 4.3.2
Credentials: Local, environment variables
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [HelloWorld

LambdaPermissionApiGateway] in the Resources block of the template

This is happening to all of our services that we try to upgrade runtime to nodejs16.x

following are my package.json and serverless.yml

serverless.yml

package.json

If I check the cloudformation template generated it's there under resources:

"HelloWorldLambdaPermissionApiGateway": {
      "Type": "AWS::Lambda::Permission",
      "Properties": {
        "FunctionName": {
          "Fn::GetAtt": [
            "HelloWorldLambdaFunction",
            "Arn"
          ]
        },
        "Action": "lambda:InvokeFunction",
        "Principal": "apigateway.amazonaws.com",
        "SourceArn": {
          "Fn::Join": [
            "",
            [
              "arn:",
              {
                "Ref": "AWS::Partition"
              },
              ":execute-api:",
              {
                "Ref": "AWS::Region"
              },
              ":",
              {
                "Ref": "AWS::AccountId"
              },
              ":",
              {
                "Ref": "ApiGatewayRestApi"
              },
              "/*/*"
            ]
          ]
        }
      }
    }

Have anyone seeing this error before? If I delete the http handler it works fine

PS: Upgrade to serverless 3.22.0 didn't work.

0 Answers
Related