How to handle stage value in html for serverless-offline use case

I have a website running on node in lambda.

It has a single static html page that is used to upload a file to an s3 bucket.

I’m able to code into the upload button link the stage value for dev, cert, prod so that it works fine there. see code below:

The problem I’m facing is that serverless-offline doesn’t seem to support managing stage values in a way that I know how to handle the link in my html above.

starting serverless offline the API’s don’t have the stage value in them

$ sls offline start -s local
Serverless: Starting Offline: local/us-east-1.
Serverless: Routes for upload:
Serverless: GET /
Serverless: GET /form
Serverless: GET /ping
Serverless: POST /upload
Serverless: Offline listening on http://localhost:8000

I would have expected the stage value even in serverless offline to be part of the API request where I would have an API POST acceptable value of “local/upload”

Am I doing something wrong or is there a way to handle offline development for this use case?

Thanks,
Eric

1 Like