I am also trying to deploy Gatsby with Auth0 onto Netlify. I have inputted the following environment variables in Netlify:
AUTH0_CALLBACK : https://domain-name.com/auth0_callback
AUTH0_CLIENTID : <sample_clientid_here>
AUTH0_DOMAIN : tenant-name.eu.auth0.com
On localhost when doing gatsby develop everything works as expexted and I can sign in succesfully using Auth0.
My .env.development file contains the following variables:
The weird thing is that I get this error message in the console when I visit domain-name.com after deploying to Netlify:
Uncaught Error: domain option is required (auth0.min.esm.js:1077)
I am wondering if it has something to do with auth0-js not being installed correctly when deploying to Netlify.
I have this dependency in package.json: "auth0-js": "^9.11.3"
I don’t know if this is enough related code, so let me know if you need more.
Thanks!
Hi guys, I read the issue faced by Enterfloat. It seems similar to mine. Development was ok but when deployed, I hit the Domain Option is required error
It seems like this problem is specifically related to netlify. I don’t have much experience with it unfortunately, and can’t find any instances of this problem internally or otherwise. Is there any way to log and make sure that the env variables are making it in successfully?
That would be my strategy. I can’t find any other instances of this error occurring, so it is unlikely that it is a bug related to a recent change in auth0.js, or something of that nature. Let me know how the log goes.
@myhendry and @dan.woda I found a solution!
Simply I had to add the prefix “GATSBY_” to all my environment variables in Netlify to make them available in browser JavaScript.