This project was created via:
$ npx create-sst@latest --template=examples/queue
Sourcemaps added from the docs:
export default {
config() {
// Config
},
stacks(app) {
app.setDefaultFunctionProps({
environment: {
NODE_OPTIONS: "--enable-source-maps",
},
bundle: {
sourcemap: true,
},
});
// Add stacks
},
} satisfies SSTConfig;
npx sst dev
Use the AWS console to send the message body fail
into the AWS SQS Queue that was created, named something like <stage-name>-devops-lambdas-Exampl-QueueConsumerQueue <random-bits>
See the logs for the intentionally thrown error:
โ Deployed:
ExampleStack
ApiEndpoint: https://<deleted>.execute-api.us-east-1.amazonaws.com
| Invoked packages/functions/src/consumer.main
| Built packages/functions/src/consumer.main
| +86ms Message processed: "fail"
| Error: Error
at main (<deleted>/devops-lambdas/packages/functions/src/consumer.ts:7:11)
at file:///<deleted>devops-lambdas/node_modules/sst/support/nodejs-runtime/index.mjs:148:22
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Success:
The stack trace correctly identifies line 7 in packages/functions/src/consumer.ts
, which does contain the throw
statement!!
npx sst deploy --stage dev
Follow the steps above, but drop it into the queue that is prefixed with dev-
, it should be something like dev-devops-lambdas-Exampl-QueueConsumerQueue<random-bits>
Dig the relevant log out of CloudWatch Logs:
2023-10-26T15:39:06.584Z 34b92a5b-f098-5733-8216-77ef7ade2ad7 ERROR Invoke Error {
"errorType": "Error",
"errorMessage": "Error",
"stack": [
"Error: Error",
" at Runtime.main [as handler] (file:///var/task/packages/functions/src/consumer.mjs:14:11)",
" at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1173:29)"
]
}
packages/functions/src/consumer.mjs:14:11
should match the stack trace when developing locally:
packages/functions/src/consumer.ts:7:11
An example serverless app created with SST.
Install the example.
$ npx create-sst@latest --template=examples/queue
# Or with Yarn
$ yarn create sst --template=examples/queue
# Or with PNPM
$ pnpm create sst --template=examples/queue
Starts the Live Lambda Development environment.
Build your app and synthesize your stacks.
Deploy all your stacks to AWS. Or optionally deploy, a specific stack.
Remove all your stacks and all of their resources from AWS. Or optionally removes, a specific stack.
Learn more about the SST.