-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guide for setting up serverless-offline-sqs + serverless-lift + localstack sqs #239
Comments
@serg06 this guide has been very helpful, so thank you for that. Also, I wanted to ask: how would you apply the patch in a |
@luismir15 This is my script # scripts/patch-serverless-offline-sqs.sh
root='.' # Project root
lib="${root}/node_modules/serverless-offline-sqs/src/sqs.js"
if grep -q patched "$lib"; then
echo sqs.js already patched
else
echo sqs.js is missing the patch, applying...
sed -i "s|const sqsEvent = new SQSEventDefinition|// patched\n const {queueName} = this.options;\n\n if (queueName) rawSqsEventDefinition.queueName = queueName;\n\n const sqsEvent = new SQSEventDefinition|" "$lib"
echo done
fi And my package.json has this: "scripts": {
"postinstall": "bash scripts/patch-serverless-offline-sqs.sh"
} |
thanks @serg06! I wanted to point out that I was getting an error while running the script
I'm in macos so the only work around was to add an empty string in the sed command found the solution here: https://myshittycode.com/2014/07/24/os-x-sed-extra-characters-at-the-end-of-l-command-error/ |
Guide for setting up serverless-offline-sqs + serverless-lift + localstack sqs
I just spent the last few hours figuring this out, so I'll share my solution with you all.
Disclaimer: This guide is only for sls offline. It likely needs modification before deploying.
Disclaimer: You will have to modify
serverless-offline-sqs
as it doesn't work withlift
by default.Set up the SQS server
Install the Node packages:
Set up your serverless.yaml
Set up your publisher
Set up your consumer
Patch serverless-offline-sqs:
This plugin has had issues with lift since forever:
In order to fix that, you need to apply a patch:
Ideally you'd apply that patch in your
postinstall
script, but you can do it manually too.Test it out
The text was updated successfully, but these errors were encountered: