Deploying Python serverless app fails with nonsensical/incomplete error message
See original GitHub issueBug Report
Description
- What did you do? Deployed a serverless app written in Python.
- What happened? Deployment failed, the only exception being
Exception -----------------------------------------------
<Buffer 54 72 61 63 65 62 61 63 6b 20 28 6d 6f 73 74 20 72 65 63 65 6e 74 20 63 61 6c 6c 20 6c 61 73 74 29 3a 0a 20 20 46 69 6c 65 20 22 2f 68 6f 6d 65 2f 63 ... >
Get Support --------------------------------------------
- What should’ve happened? I expect a readable and complete exception message as to what failed.
- What’s the content of your
serverless.yml
file?
service: name
provider:
name: aws
runtime: python3.6
stage: ${opt:stage, 'dev'}
region: eu-west-1
timeout: 30
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:BatchGetItem
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
- dynamodb:DescribeTable
- dynamodb:CreateTable
- dynamodb:GetRecords
Resource:
- { "Fn::GetAtt": ["DynamoTable", "Arn"] }
- Effect: Allow
Action:
- sns:Publish
Resource: ${self:custom.topicArn}
environment:
NS_AWS_REGION: '${self:provider.region}'
NS_TOPIC_ARN:
Ref: NSChannel
NS_ACCESS_KEY_ID: REDACTED
NS_SECRET_ACCESS_KEY: REDACTED
plugins:
- serverless-python-requirements
- serverless-wsgi
- serverless-domain-manager
custom:
tableName: 'ns-${self:provider.stage}'
topicName: 'ns-${self:provider.stage}'
domainEnvSuffix:
dev: -dev
prod: ''
customDomain:
domainName: ${self:service}${self:custom.domainEnvSuffix.${self:provider.stage}}.example.com
certificateName: '*.example.com'
stage: ${self:provider.stage}
createRoute53Record: true
endpointType: edge
wsgi:
app: main.app
packRequirements: true
pythonRequirements:
dockerizePip: non-linux
topicArn:
Fn::Join:
- ''
- - 'arn:aws:sns:'
- Ref: AWS::Region
- ":"
- Ref: AWS::AccountId
- ":"
- Fn::GetAtt:
- NSChannel
- TopicName
functions:
app:
handler: wsgi_handler.handler
events:
- http: ANY /
- http: 'ANY {proxy+}'
probeUrls:
handler: main.check_all
events:
- schedule:
rate: cron(*/5 * * * ? *)
enabled: true
resources:
Resources:
DynamoTable:
Type: 'AWS::DynamoDB::Table'
Properties:
...REDACTED...
NSChannel:
Type: "AWS::SNS::Topic"
Properties:
TopicName: ${self:custom.topicName}
- What’s the output you get when you use the
SLS_DEBUG=*
environment variable (e.g.SLS_DEBUG=* serverless deploy
)
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command config:tabcompletion
Serverless: Load command config:tabcompletion:install
Serverless: Load command config:tabcompletion:uninstall
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command requirements
Serverless: Load command requirements:clean
Serverless: Load command requirements:install
Serverless: Load command requirements:cleanCache
Serverless: Load command wsgi
Serverless: Load command wsgi:serve
Serverless: Load command wsgi:install
Serverless: Load command wsgi:clean
Serverless: Load command wsgi:command
Serverless: Load command wsgi:command:local
Serverless: Load command wsgi:exec
Serverless: Load command wsgi:exec:local
Serverless: Load command wsgi:manage
Serverless: Load command wsgi:manage:local
Serverless: Load command wsgi:flask
Serverless: Load command wsgi:flask:local
Serverless: Load command create_domain
Serverless: Load command delete_domain
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Generated requirements from requirements.txt in /serverless/requirements.txt...
Serverless: Installing requirements from .serverless/requirements/requirements.txt ...
Serverless: Running ...
Serverless: Using Python specified in "runtime": python3.6
Serverless: Packaging Python WSGI handler...
Serverless: Packaging required Python packages...
Exception -----------------------------------------------
<Buffer 54 72 61 63 65 62 61 63 6b 20 28 6d 6f 73 74 20 72 65 63 65 6e 74 20 63 61 6c 6c 20 6c 61 73 74 29 3a 0a 20 20 46 69 6c 65 20 22 2f 68 6f 6d 65 2f 63 ... >
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 10.16.3
Framework Version: 1.59.3
Plugin Version: 3.2.5
SDK Version: 2.2.1
Components Core Version: 1.1.2
Components CLI Version: 1.4.0
If you translate the hexdump in the buffer object, you will see that it is the beginnings of a Python stack trace:
Traceback (most recent call last):
File "/home/c
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Top 10 Serverless Deployment Errors (and How to Fix Them)
The most common error I see our users encounter is when a deploy fails because a previous deploy was unsuccessful. · This situation...
Read more >Error deploying Python package to AWS lambda using ...
This is an open issue as on date 10th March 2022. The serverless plugin rewrites the file into .serverless directory & it assumes...
Read more >How do I handle errors in serverless applications? - AWS
In this tutorial, you will design and run a serverless workflow using AWS Step Functions that will gracefully handle these errors. You'll create...
Read more >Python SDK - Serverless Framework
This will cause the invocation to still display as an error in the serverless ... To alleviate this issue, when deploying a Flask...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@medikoo your understanding is correct, and it was reported here: https://github.com/logandk/serverless-wsgi/issues/122
@mfsjr this should be reported to project which propagates buffer as an exception. In my understanding it’s one of the plugins that you rely on, and not the Framework (Framework just surfaces the error that came out from a plugin, as it is)