Dashboard breaks deployments and cause lambda to timeout
See original GitHub issueBug Report
Description
-
What did you do? I can’t pinpoint exactly what the problem is, but it started when I deleted my serverless app from the dashboard UI then created a new one. After updating my
serverless.yml
file and runningsls deploy
my lambda function was timing out and was unreachable. -
What happened? it took me a while to figure out what was happening, but it seems like sending traces to serverless API was the part causing it to timeout. After commenting out the dashboard specific fields from my
serverless.yml
(app and org) and deploying it worked again. This morning I tried doingsls remove
then deploying everything again to start with a clean state with the dashboard integrated but I was getting this error when runningsls deploy
An error occurred: ApiGatewayLogGroup - /aws/api-gateway/omniview-backend-dev already exists.
So I deleted all resources and the cloudformation stack manually from AWS UI then tried deploying again with sls deploy
and received this error
Error: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>504 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
CloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection.
<BR clear="all"/>
If you received this error while trying to use an app or access a website, please contact the provider or website owner for assistance.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by following steps in the CloudFront documentation
(<A href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/http-504-gateway-timeout.html">https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/http-504-gateway-timeout.html</A>).
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: LgMy8NXtw34GmqDYCLHbZdxTa-g5gR4--JemQlZUjywDSgC38w1MGw==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>
at _callee$ (/usr/local/lib/node_modules/serverless/node_modules/@serverless/platform-sdk/src/utils/checkHttpResponse.js:19:9)
at tryCatch (/usr/local/lib/node_modules/serverless/node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (/usr/local/lib/node_modules/serverless/node_modules/regenerator-runtime/runtime.js:271:22)
at Generator.prototype.<computed> [as next] (/usr/local/lib/node_modules/serverless/node_modules/regenerator-runtime/runtime.js:97:21)
at step (/usr/local/lib/node_modules/serverless/node_modules/@serverless/platform-sdk/dist/utils/checkHttpResponse.js:7:191)
at /usr/local/lib/node_modules/serverless/node_modules/@serverless/platform-sdk/dist/utils/checkHttpResponse.js:7:361
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
So I disabled the dashboard from serverless.yml
and deployed and everything worked again.
-
What should’ve happened? Dashboard should not break
sls deploy
or cause a lambda function to timeout if it can’t communicate with the dashboard API or better error messages should be thrown. -
What’s the content of your
serverless.yml
file?
service:
name: ovs-backend
# app: <dashboard app name>
# org: <dashboard org name>
custom:
aws_profile: "ovs"
environment: ${file(env.yml):${self:provider.stage}, file(env.yml):default}
warmup:
enabled: true
prewarm: true
concurrency: 1
# Add the serverless-webpack plugin
plugins:
- serverless-offline
- serverless-plugin-warmup
provider:
name: aws
runtime: nodejs10.x
stage: ${opt:stage, 'dev'}
profile: ${self:custom.aws_profile} # aws credentials profile to use
region: ${opt:region, 'eu-central-1'}
apiGateway:
minimumCompressionSize: 1024
tracing:
apiGateway: true
lambda: true
environment:
MONGO_URL: ${self:custom.environment.MONGO_URL}
ENGINE_API_KEY: ${self:custom.environment.ENGINE_API_KEY}
BASE_URL: ${self:custom.environment.BASE_URL}
NODE_ENV: PRODUCTION
AWS_STAGE: ${self:provider.stage}
iamRoleStatements:
- Effect: 'Allow'
Action:
- "lambda:InvokeFunction"
Resource:
- Fn::Join:
- ':'
- - arn:aws:lambda
- Ref: AWS::Region
- Ref: AWS::AccountId
- function:${self:service}-${self:provider.stage}-*
functions:
hello:
handler: api/handler.hello
events:
- http:
path: hello
method: get
graphql:
handler: api/graphqlHandler.graphqlHandler
events:
- http:
path: playground
method: get
cors: true
- http:
path: graphql
method: post
cors: true
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (11 by maintainers)
Short term fix I’ve found to deploy a service, have it connected to the serverless dashboard, and use callback functions to return lambda functions:
npm uninstall -g serverless
npm i -g serverless@1.52.0
app
andorg
fromserverless.yml
app
andorg
toserverless.yml
The reason to remove
app
andorg
and redeploy with v1.52.0: If you’ve previously had a service connected to dashboard and you’ve run into this issue then there is an cloudwatch log group for the service that will prevent the deployment. Redeploying withoutapp
&org
removes this log group for you so you can reconnect to the dashboard.The lambdas that utilize callback functions also operate and terminate as expected when deployed with v1.52.0 (Also the logs will display on the dashboard instead of saying you need to install the enterprise plugin )
Looks to me like using
app
andorg
to utilize the serverless dashboard starts to break after v1.52.0 with the abstraction of the Framework Core, Plugin, and SDK into more pieces.@dschep I still can reproduce it with 1.53.0. Short term solution is to remove app and org from serverless.yml.