From a chat working on the Courts project, where I had issues deploying to Netlify:
There is an issue with environment variables and the gatsby-source-google-docs package. My local environment requires different variables than what works on Netlify. Locally, my docker environment required these env variables:
GOOGLE_OAUTH_CLIENT_ID
GOOGLE_OAUTH_CLIENT_SECRET
GOOGLE_DOCS_TOKEN
In deployment, the build requires a single variable, which contains the values from the above variables:
GATSBY_SOURCE_GOOGLE_DOCS_TOKEN
At first, I couldn’t get the single variable to work locally. My local build worked when I changed the variables to match what’s required by the gatsby-source-google-docs package’s latest version. When trying to deploy a review app, the multiple variables would not work on the Netlify deployment.
I suspect that the different environments are using different versions of the gatsby-source-google-docs package. I don’t know how to dig into the deployment to find which version the deployment build uses, but this seems like something we need to figure out going forward. Has been a headache for me.
Steps to reproduce
Clone the charges-app repo and try to run it based on the env instructions in the README + the credentials from the "Courts credentials" in LastPass.
You should have issues related to gatsby-source-google-docs and Google OAuth tokens.
Replace the GATSBY_SOURCE_GOOGLE_DOCS_TOKEN env variable with the three variables noted above. You'll have to remove the client_id and client_secret from the original variable, and then set those values to their respective GOOGLE_OAUTH_CLIENT_ID and GOOGLE_OAUTH_CLIENT_SECRET env variables. Then rename the GATSBY_SOURCE_GOOGLE_DOCS_TOKEN to GOOGLE_DOCS_TOKEN.
Once you've changed the variables, run the app locally. This should work.
Try to deploy a review app using the three variables instead of the one. This should not work.
Try to deploy using the single GATSBY_SOURCE_GOOGLE_DOCS_TOKEN. This should work.
Description
From a chat working on the Courts project, where I had issues deploying to Netlify:
There is an issue with environment variables and the
gatsby-source-google-docs
package. My local environment requires different variables than what works on Netlify. Locally, my docker environment required these env variables:GOOGLE_OAUTH_CLIENT_ID
GOOGLE_OAUTH_CLIENT_SECRET
GOOGLE_DOCS_TOKEN
In deployment, the build requires a single variable, which contains the values from the above variables:
GATSBY_SOURCE_GOOGLE_DOCS_TOKEN
At first, I couldn’t get the single variable to work locally. My local build worked when I changed the variables to match what’s required by the
gatsby-source-google-docs
package’s latest version. When trying to deploy a review app, the multiple variables would not work on the Netlify deployment.I suspect that the different environments are using different versions of the
gatsby-source-google-docs
package. I don’t know how to dig into the deployment to find which version the deployment build uses, but this seems like something we need to figure out going forward. Has been a headache for me.Steps to reproduce
gatsby-source-google-docs
and Google OAuth tokens.GATSBY_SOURCE_GOOGLE_DOCS_TOKEN
env variable with the three variables noted above. You'll have to remove theclient_id
andclient_secret
from the original variable, and then set those values to their respectiveGOOGLE_OAUTH_CLIENT_ID
andGOOGLE_OAUTH_CLIENT_SECRET
env variables. Then rename theGATSBY_SOURCE_GOOGLE_DOCS_TOKEN
toGOOGLE_DOCS_TOKEN
.GATSBY_SOURCE_GOOGLE_DOCS_TOKEN
. This should work.