serverless-plugins
serverless-plugins copied to clipboard
serverless-offline-sqs - SQS and HTTP events
Hello,
I'm trying to make this configuration work:
...
plugins:
...
- serverless-offline-sqs #@4.0.1
- serverless-offline #@6.4.0
custom:
...
serverless-offline-sqs:
autoCreate: true
apiVersion: '2012-11-05'
endpoint: http://localhost:9324
region: eu-west-1
accessKeyId: root
secretAccessKey: root
skipCacheInvalidation: false
provider:
name: aws
runtime: nodejs12.x
region: eu-west-1
...
functions:
main:
handler: src/handlers/any.handler
memorySize: 256
events:
- http:
method: any
path: /{any+}
cors: true
job:
handler: src/handlers/job.handler
memorySize: 256
events:
- sqs:
arn:
Fn::GetAtt:
- MainQueue
- Arn
resources:
Resources:
MainQueue:
Type: "AWS::SQS::Queue"
Properties:
QueueName: "MainQueue"
Unfortunately, when i run the project, only one of the two lambda works.. what i mean is, if i run the project without the SQS plugins, the "http" lambda correctly starts up and i can make http calls at it, but when i start the project with the SQS plugin, only the SQS lambda correctly starts. Im unable to make them both work at the same time, any help?
@manniniandrea I faced same issue, after a bit of debugging I was able to work it around by setting NODE_ENV=test
I am also getting this bug.
I am curious, what causes this, and why does that environment variable help?
Experienced the same problem here. I'm curious is this related to the ready
method? What's the purpose of listening for termination?
Experiencing the same issue... when serverless-offline-sqs is enabled.... good luck testing your lambda's directly! doesn't work. One or the other. Please fix this, defeats the entire purpose.
@AdrieanKhisbe any ETA on a fix for this?
@liquidautumn how did you figure out that setting that ENV got it to work?
Even weirder, NODE_ENV=test
is not needed if you add start
to the command line.
This does not work:
node ./node_modules/.bin/sls offline -s local --noPrependStageInUrl
This works:
node ./node_modules/.bin/sls offline start -s local --noPrependStageInUrl
The side effect is that you have to hit CTRL-C
twice to exit.