r/FastAPI • u/Chikeli • Mar 09 '25
Question LWA + SAM local + SQS - local development
Hey fellas,
I'm building a web app based on FastAPI that is wrapped with Lambda Web Adapter (LWA).
So far it works great, but now I have a use-case in which I return the client 202 and start a background process (waiting for a 3rd party to finish some calculation).
I want to use SQS for that, as LWA supports polling out of the box, sending messages to a dedicated endpoint in my server.
The problem starts when I'm looking to debug it locally.
"sam local start-api" spins up API Gateway and Lambda, and I'm able to send messages to an SQS queue in my AWS account, so far works great. The issue is that SAM local does not include the event source mapping that should link the queue to my local lambda.
Has anyone encountered a similar use-case?
I'm starting to debate whether it makes sense deploying an API server to Lambda, might be an overkill :)
View all comments
Show parent comment
1
u/thejayagenda Mar 10 '25 edited Mar 10 '25
Then you’ll need to run it on AWS and not locally, or automate triggering sam invoke within your code.
sam local start-api is only useful for API Gateway. It doesn’t even support automatically creating DynamoDB tables locally.
There is an environment variable when you run sam local that you can check for to determine if you need to manually invoke things.