Accessing stage or env variables in lambda

Log in to the AWS console and find your Lambda. When you’re on the code tab for the function scroll down and look for “Environment variables”. Does it have an environment variable called bucket listed?

If bucket isn’t defined then try hard coding a value like bucket: "xxx" and deploy again. Once you have it deploying with a value it should be easy to make it stage specific.

You can reference local environment variables using self but the stage is in the provider section so it’s provider.stage and not just stage. Hence it the whole variable is ${self:provider.stage}.