Current Behavior
You encounter the following exception if you use an environment variable without it being defined in the local shell:
Debug: internal, implementation, error
TypeError: Cannot read property 'Fn::Join' of undefined
at /Users/alexhayton/personal/stablemaster/lambda/node_modules/serverless-offline/dist/utils/resolveJoins.js:17:28
at Array.forEach (<anonymous>)
at resolveJoins (/Users/alexhayton/personal/stablemaster/lambda/node_modules/serverless-offline/dist/utils/resolveJoins.js:15:28)
at new LambdaFunction (/Users/alexhayton/personal/stablemaster/lambda/node_modules/serverless-offline/dist/lambda/LambdaFunction.js:154:56)
at LambdaFunctionPool.get (/Users/alexhayton/personal/stablemaster/lambda/node_modules/serverless-offline/dist/lambda/LambdaFunctionPool.js:93:24)
at Lambda.get (/Users/alexhayton/personal/stablemaster/lambda/node_modules/serverless-offline/dist/lambda/Lambda.js:60:88)
at hapiHandler (/Users/alexhayton/personal/stablemaster/lambda/node_modules/serverless-offline/dist/events/http/HttpServer.js:511:82)
at module.exports.internals.Manager.execute (/Users/alexhayton/personal/stablemaster/lambda/node_modules/@hapi/hapi/lib/toolkit.js:41:33)
at Object.internals.handler (/Users/alexhayton/personal/stablemaster/lambda/node_modules/@hapi/hapi/lib/handler.js:46:48)
at exports.execute (/Users/alexhayton/personal/stablemaster/lambda/node_modules/@hapi/hapi/lib/handler.js:31:36)
at Request._lifecycle (/Users/alexhayton/personal/stablemaster/lambda/node_modules/@hapi/hapi/lib/request.js:312:68)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Request._execute (/Users/alexhayton/personal/stablemaster/lambda/node_modules/@hapi/hapi/lib/request.js:221:9)
Sample Code
service: my-service
plugins:
- serverless-offline
provider:
runtime: nodejs12.x
stage: dev
environment:
MY_ENV_VAR: ${env:MY_ENV_VAR}
functions:
hello:
events:
- http:
method: get
path: hello
handler: handler.hello
'use strict'
const { stringify } = JSON
exports.hello = async function hello() {
return {
body: stringify({ foo: 'bar' }),
statusCode: 200,
}
}
Expected behavior/code
It should just deal with it
Environment
serverless version: v1.75.1serverless-offline version: v6.5.0node.js version: v12.16.1OS: macOS 10.15.6Possible Solution
I also got this error, as stated in https://github.com/dherault/serverless-offline/pull/1047 it was due to an undefined environment variable in serverless.yml
After removing the var, the issue disapeared
Most helpful comment
I also got this error, as stated in https://github.com/dherault/serverless-offline/pull/1047 it was due to an undefined environment variable in serverless.yml
After removing the var, the issue disapeared