fastify / fastify/aws-lambda-fastify

decorateRequest is not thread safe

Open
#254 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
559
Forks
37
PR merge metrics
No merged PRs in 30d

Description

Due to the way the code for `decorateRequest` is written, when multiple requests are executed concurrently the [`currentAwsArguments` cache variable](https://github.com/fastify/aws-lambda-fastify/blob/main/index.js#L22) will clash and overwrite wrong event and context data between the simultaneous requests.

Contributor guide

Open the contributing guide

Research direction

Start in index.js around line 22, where the currentAwsArguments cache variable used by decorateRequest is defined. Reproduce concurrent requests and trace how event and context data are paired; done means simultaneous requests no longer overwrite one another’s data.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, node.js
Domain
api, backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.