We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Current Behavior
From (at least) version 9.x up through 12.x, we were able to mock authorizers, based on what the readme currently says:
You are able to mock the response from remote authorizers by setting the environmental variable AUTHORIZER before running sls offline start
AUTHORIZER
sls offline start
Example:
Unix: export AUTHORIZER='{"principalId": "123"}'
export AUTHORIZER='{"principalId": "123"}'
Windows: SET AUTHORIZER='{"principalId": "123"}'
SET AUTHORIZER='{"principalId": "123"}'
Ever since 13.x was released, this fails to work.
Sample Code
service: sls-playground provider: name: aws runtime: nodejs16.x custom: serverless-offline: httpPort: 4000 websocketPort: 4001 lambdaPort: 4002 functions: hello: handler: handler.hello events: - httpApi: path: / method: get plugins: - serverless-offline
exports.hello = async (event) => { return { statusCode: 200, body: JSON.stringify({ message: "Go Serverless v4! Your function executed successfully!", event }), }; };
Run the following from a terminal window:
export AUTHORIZER='{"principalId":"123"}' && sls offline start
Expected behavior/code
The event.requestContext object should have an authorizer prop with what was set on the terminal:
event.requestContext
authorizer
"requestContext": { "accountId": "offlineContext_accountId", "apiId": "offlineContext_apiId", "authorizer": { "principalId": "123" },
Environment
serverless
serverless-offline
node.js
OS
Possible Solution
PR that introduced this feature: #475
Additional context/Screenshots
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Bug Report
Current Behavior
From (at least) version 9.x up through 12.x, we were able to mock authorizers, based on what the readme currently says:
Remote authorizers
You are able to mock the response from remote authorizers by setting the environmental variable
AUTHORIZER
before runningsls offline start
Example:
Ever since 13.x was released, this fails to work.
Sample Code
Run the following from a terminal window:
Expected behavior/code
The
event.requestContext
object should have anauthorizer
prop with what was set on the terminal:Environment
serverless
version: 4.4.5serverless-offline
version: 12.0.4 WORKS, but anything after (13.x+, 14.x+) is brokennode.js
version: 22.9.0OS
: macOS 15.0.1Possible Solution
PR that introduced this feature: #475
Additional context/Screenshots
The text was updated successfully, but these errors were encountered: