I was working on this same project today and trying to figure out this exact same problem but found the solution. It's an old question but for those still doing this workshop and come across this.
Reason why -
- you have a file called
.env
that has your astra info on it
- because you have this file on your local host, it will run
netlify dev
properly and use the info from that file
- the problem is when you launch on the web, you can still have
.env
on your repository but it is ignored because of the .gitignore
file
- even if you delete the command in the
.gitignore
file, it won't work (no idea why)
Solution -
- you have to import the
.env
info to your netlify environment variable so it can connect your netlify to your astra through the actual servers
Run this command in your integrated terminal:
netlify env:import .env
After rebuild and redeploy to production with netlify:
netlify build
netlify deploy -p
Note: I'm not 100% positive if it is necessary to build and deploy again. It just happened to not work for me until I did.