Error in retrieving cloudformation template

aws

#1

Hello, I am fairly new to serverless and I am getting the following error when trying to deploy. I created the bucket and the file does exist.

Here is my serverless.yml (without the lambdas):

provider:
name: aws
runtime: python2.7
role: arn:aws:iam::ACCT_NUMBER:role/LambdaExecutionRole
profile: nitro-dev
deploymentBucket:
name: REDACTED
serverSideEncryption: AES256 # when using server-side encryption
environment:
ENV: dev1
REGION: us-west-2
BASE_URL: REDACTED
stage: dev1
region: us-west-2

When I run sls deploy:

$ sls deploy --verbose

Serverless: WarmUP: setting 5 lambdas to be warm
Serverless: WarmUP: REDACTED
Serverless: WarmUP: REDACTED
Serverless: Installing requirements of requirements.txt in .serverless…
Serverless: Packaging service…
Serverless: Excluding development dependencies…
Serverless: Excluding development dependencies…
Serverless: Injecting required Python packages to package…
Serverless: Uploading CloudFormation file to S3…
Serverless: Uploading artifacts…
Serverless: Uploading service .zip file to S3 (12.66 MB)…
Serverless: Uploading service .zip file to S3 (755 B)…
Serverless: Validating template…
Error --------------------------------------------------
The CloudFormation template is invalid: S3 error: Unable to get the object https://s3.amazonaws.com/REDACTED/serverless/dev1/1535520222094-2018-08-29T05:23:42.094Z/compiled-cloudformation-template.json

I am not sure why the cloudformation template cannot be fetched from S3 as it does exist and my IAM credentials have access to download it. Any help will be appreciated.

Thanks
Arani


#2

I run into the same issue. Did anyone work around it?


#3

Hi there, Have you got that solved? Met the same issue.


#4

I’ve got the same problem.

I first tried deleting the local .serverless directory, which made no difference.

Then, I checked and I’m able to use s3 cp s3://xxx . to download the file, so I know I have permission to get it, then I enabled extra debugging to get this more detailed error message:

Error: The CloudFormation template is invalid: S3 error: Unable to get the object https://s3.amazonaws.com/xxxxxxx/compiled-cloudformation-template.json
    at provider.request.catch (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/lib/validateTemplate.js:25:13)
From previous event:
    at AwsDeploy.validateTemplate (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/lib/validateTemplate.js:20:12)
From previous event:
    at AwsDeploy.BbPromise.bind.then (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:121:39)
From previous event:
    at Object.aws:deploy:deploy:validateTemplate [as hook] (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:117:10)
    at BbPromise.reduce (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:391:55)
From previous event:
    at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:391:22)
    at PluginManager.spawn (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:409:17)
    at AwsDeploy.BbPromise.bind.then (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:95:48)
From previous event:
    at Object.deploy:deploy [as hook] (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:91:10)
    at BbPromise.reduce (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:391:55)
From previous event:
    at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:391:22)
    at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:422:17)
    at variables.populateService.then.then (/usr/local/lib/node_modules/serverless/lib/Serverless.js:157:33)
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
    at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:144:8)
    at serverless.init.then (/usr/local/lib/node_modules/serverless/bin/serverless:44:28)
    at <anonymous>

#5

I’ve now upgraded to the latest version (1.34 at the time of writing) which also made no difference.

Started a new terminal, same error.
Restarted my computer, no difference.
Removed Serverless Framework and reinstalled, no difference.

Removed myself from the “Enforce MFA Policy” group, it works!

Strange, I can download the file from the CLI when I’m a member of the group, but Serverless Framework can’t. Not sure if that’s a bug, where it doesn’t pick up the session token or not.