New AWS Lambda Example error: Failure: serverlessExpress is not a function
See original GitHub issueDescription
Sorry about the spam - Github server was spasming when i hit submit and it hung, i must have hit refresh. Apologies.
Due to the new guidelines about the deprecation of aws-serverless-express - i've updated my code to the new app.js example, as well as updated @slack/bolt to 3.2.0. I have the latest @vendia/serverless-express@3.4.0. Here is my npm list of serverless - (does it need to **not** be a dependency of aws-serverless-express@3.4.0 ?)
_user$ npm list @vendia/serverless-express
myl-app@1.0.0 /Library/WebServer/Documents/App/my-app
βββ¬ aws-serverless-express@3.4.0
βββ @vendia/serverless-express@3.4.0_
β running my app code that worked before the updgrade, i receive this error:
**offline: POST /slack/events (Ξ»: slack)
offline: Failure: serverlessExpress is not a function
TypeError: serverlessExpress is not a function
at Object.<anonymous> (/Library/WebServer/Documents/App/my-app/app.js:60:26)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at /Library/WebServer/Documents/App/my-app/node_modules/serverless-offline/dist/lambda/handler-runner/in-process-runner/InProcessRunner.js:145:133
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at InProcessRunner.run (/Library/WebServer/Documents/App/my-app/node_modules/serverless-offline/dist/lambda/handler-runner/in-process-runner/InProcessRunner.js:145:9)**
Thinking that it was my code that caused the issue, i just ran the exact code from here: https://github.com/slackapi/bolt-js/blob/main/examples/deploy-aws-lambda/app.js
Still getting the same error.
Here is the serverless local app start:
_Serverless: Deprecation warning: Starting with next major version, default value of provider.lambdaHashingVersion will be equal to "20201221"
More Info: https://www.serverless.com/framework/docs/deprecations/#LAMBDA_HASHING_VERSION_V2
Serverless: Deprecation warning: Starting with next major version, API Gateway naming will be changed from "{stage}-{service}" to "{service}-{stage}".
Set "provider.apiGateway.shouldStartNameWithService" to "true" to adapt to the new behavior now.
More Info: https://www.serverless.com/framework/docs/deprecations/#AWS_API_GATEWAY_NAME_STARTING_WITH_SERVICE
offline: Starting Offline: dev/us-east-1.
offline: Offline [http for lambda] listening on http://localhost:3002
offline: Function names exposed for local invocation by aws-sdk:
* slack: serverless-bolt-js-dev-slack
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β POST | http://localhost:3000/slack/events β
β POST | http://localhost:3000/2015-03-31/functions/slack/invocations β
β GET | http://localhost:3000/slack/install β
β POST | http://localhost:3000/2015-03-31/functions/slack/invocations β
β GET | http://localhost:3000/slack/oauth_redirect β
β POST | http://localhost:3000/2015-03-31/functions/slack/invocations β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
offline: [HTTP] server ready: http://localhost:3000 π
offline:
offline: Enter "rp" to replay the last request_
Your help is greatly appreciated. Thank you very much for your attention π Andy
What type of issue is this? (place an x
in one of the [ ]
)
- bug
- enhancement (feature request)
- question
- documentation related
- example code related
- testing related
- discussion
Requirements (place an x
in each of the [ ]
)
- Iβve read and understood the Contributing guidelines and have done my best effort to follow them.
- Iβve read and agree to the Code of Conduct.
- Iβve searched for any related issues and avoided creating a duplicate issue.
Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
package version: @slack/bolt 3.2.0 @vendia/serverless-express@3.4.0
node version: v12.18.3
OS version(s): mac os sierra 10.12.6 (16G2136)
Steps to reproduce:
1.Follow the steps here exactly: https://slack.dev/bolt-js/deployments/aws-lambda 2. 3.
Expected result:
Local app to process Slack request / input
Actual result:
Error processing the Slack request / input
offline: POST /slack/events (Ξ»: slack)
offline: Failure: serverlessExpress is not a function
TypeError: serverlessExpress is not a function
at Object.<anonymous> (/Library/WebServer/Documents/HeyAxl/hey-axl-app/app.js:60:26)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at /Library/WebServer/Documents/HeyAxl/hey-axl-app/node_modules/serverless-offline/dist/lambda/handler-runner/in-process-runner/InProcessRunner.js:145:133
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at InProcessRunner.run (/Library/WebServer/Documents/HeyAxl/hey-axl-app/node_modules/serverless-offline/dist/lambda/handler-runner/in-process-runner/InProcessRunner.js:145:9)
Attachments:
Logs, screenshots, screencast, sample project, funny gif, etc.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Hi @mwbrooks, I had to finish my code for the night and so i reverted to the deprecated aws-serverless-express version of my code - got it all working that way for now. I have to switch hats and work on another app - i will try to confirm tomorrow or the day after. Thank you so much for figuring this out!
@avery100 No worries and thanks for taking the time to help us confirm the fix! ππ» Iβve merged PR #806, which updates the documentation and example app. I tested it locally and on AWS Lambda.
If youβve reverted to the older approach, then you should be able to use
@vendia/serverless-express@3.x.x
because it uses the original.createServer
and.proxy
interface.Otherwise, you can update your code to use the modern approach, which requires
@vendia/serverless-express@4.x.x
.