#Prod deploy on Netlify using Dev DB?

14 messages · Page 1 of 1 (latest)

unique oracle
#

Hey, just deployed my first Convex app on Netlify. So easy! Thanks for making it such a smooth experience!

One snag: I'm seeing that my deployed app is hitting my dev db/instance. I've double checked that I used the right deploy key and all, so I'm not sure what to check on next. What could be up? Let me know if any links/screenshots would be helpful!

Thanks!

forest warren
unique oracle
forest warren
#

Yeah, ideally the prod bundle would be using that one and the dev bundle/dev server would be using the .env.local one

unique oracle
#

Is that something I could have conceivably mixed up myself? 😅

(also hi!)

forest warren
#

I mix them up sometimes so yeah maybe? During the project setup process it writes the dev URL to .env.local and the prod URl to .env, so that part is more likely right

#

from the repo, those files say utmost-beaver should be dev and stoic-salmon should be prod

unique oracle
forest warren
#

@unique oracle a colleague just pointed out to me that since this .env.local isn't .gitignored, that file of credentials is probably being preferred in Netlify

#

we have some changes in the pipeline to examine the .gitignore file and add .env.local to help with this

unique oracle
#

Ah, there's also this in the Netlify docs (https://docs.netlify.com/configure-builds/environment-variables/). After I imported the .env file it's now pinging stoic-salmon, so yay

Note that when you build on Netlify, the build system doesn’t read .env files. To use variables declared in a .env file, we recommend you import the variables into Netlify before you build. This way the variables in your .env file remain secure and out of your shared repository.

forest warren
#

Ah good pointer. Currently the automatic flow is more Vercel-centric, they suggest committing the .env, but we're moving to recommending this Netlify style where these are added manually.

#

Hm I wonder if Vite still reads these environment variables from .env on Netlify — guessing it was Vite choosing .env.local over .env

#

Glad things are working, helpful feedback for us to clean this up!