Skip to content
New issue

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

process.env.IS_OFFLINE is not working #959

Closed
gleidsonh opened this issue Apr 14, 2020 · 4 comments
Closed

process.env.IS_OFFLINE is not working #959

gleidsonh opened this issue Apr 14, 2020 · 4 comments

Comments

@gleidsonh
Copy link

In previous versions of the plugin, process.env.IS_OFFLINE worked correctly, but after updating it shows undefined.

Do I need to configure something else or is it a bug?

package.json dependecies

"serverless-domain-manager": "3.3.1",
    "serverless-dotenv-plugin": "^2.3.2",
    "serverless-offline": "^6.1.4",
    "serverless-plugin-include-dependencies": "4.0.0"

serverless --version

Framework Core: 1.67.3
Plugin: 3.6.6
SDK: 2.3.0
Components: 2.29.2
@el2ro
Copy link

el2ro commented Apr 14, 2020

It seems to be removed feature: #768
So simple work-around would e.g. like this

provider:
  environment:    
    IS_OFFLINE: true
    # or with parameter check, which is set when launching > OFFLINE=true sls offline start
    # IS_OFFLINE: ${env:OFFLINE}

@gleidsonh
Copy link
Author

Thank you very much for your help and readiness.

It works. =]

@XuluWarrior
Copy link

The removal of IS_OFFLINE (and preserveTrailingSlash) has been a complete pain for me.
I'm not going to be one of those that demand that a pet feature is returned as I know maintainers have their own priorities and needs. But I did want to share that they had value to me.

IS_OFFLINE was useful to me because I have a common library that needs to work both as an express server and a Serverless lamba (on AWS and offline) (I use serverless-http). Because the request paths are different in each scenario, I relied on IS_OFFLINE to make the changes necessary.
Relying on the caller setting IS_OFFLINE would mean changing everywhere this library is used even if the calling code doesn't use the variable itself.

Removing preserveTrailingSlash broke my code that used serverless-http and express static(). Trailing slashes are required to serve a directory.

I have finally managed to work around losing these, so I am happy that I can upgrade to 6.x. Just a little frustrated, that's all. ;P

@XuluWarrior
Copy link

I see that process.env.IS_OFFLINE has been restored in 8755d9d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants