BRANCH env variable is undefined using gatsby cloud

Viewed 285

Read-only variables
These variables are pre-defined for both Builds and Preview environments. They are set automatically and cannot be changed. You can reference them in your gatsby-config.js or anywhere else you would normally reference an environment variable.

  • BRANCH: The name of the current git branch. Useful for swapping environment variables depending on the branch.
  • CI: Always true.
  • GATSBY_CLOUD: Always true. Useful for checking if your build is running on Gatsby Cloud.

This is what gatsby cloud doc said.

but when I print out console for the process.env.BRANCH, it was undefined while process.env.GATSBY_CLOUD is true as expected.

Any help is welcomed.

0 Answers
Related