Problems with environment variables

Hi there,

I am running a Gatsby site, now that I have branch deploys working and being deployed to the right subdomain, I would like to set an ENVIRONMENT VAR for my STAGING Branch Deploy.

I have been reading all the threads I have found , but had not success yet.
Development and Production were working fine using .env.XXX files. until now, but that’s Gatsby normal build process.

I have been trying to create a .end.STAGING file without sucess, now I am moving the variables to netlify.toml but still struggling to get it working.

In my netlify.toml I have added:

[context.staging.environment]
NODE_ENV = “staging”
WEB_URL = “https://staging.startuponsale.com/

Overall idea is, the WEB_URL is going to be different when in production. (This is the first simple step to change ENDPOINTS)

Well, none of the variables is accessed during build:

  • NODE_ENV is not updated and .env.staging is not read (now this has been removed from repo)
  • WEB_URL is undefined when accessed to do: <a href={process.env.WEB_URL + “/projects”}>

Any idea on what to test?

Thanks.