When I first enabled the integration, all of the PLANETSCALE_foo environment variables were missing a value for branch deploys. Here’s an example of what my dashboard looked like.
This might be an artifact of, when I set it up, not having a separate database yet for development.
However, I went back to Planetscale, made a development branch of the database, then disabled the netlify integration and re-enabled it. I now have values filled in for all the environment variables, but the problem persists.
We’re currently working through adding flows for branch-deploys across our integrations, PlanetScale being the first stop which should be done for the end of next week.
In the meantime, deploy previews and local development (via netlify dev) are both supported really well so you shouldn’t have any issues.
For now, I guess I am have to develop on production.
I am really interested by this, could you expand a bit on your workflow as to why deploy previews or local development aren’t sufficient here? Just so I can ensure you’re represented properly in our discussions internally.
Luckily I am pre-launch, so it’s not the biggest deal, but I would like to change that soon. But here’s my experience. This is my first time working with Netlify so apologies if I have missed something important. I’m a pro game dev with a bunch of other experience including big chunks of the web stack, but web is not my typical day to day, so there may be gaps in my understanding there.
The features/integrations I’m using are:
branch deploy for development (haven’t done this in a while because of the issue in first post)
Project based on your Next.js template
Local netlify command-line interface, running netlify dev to host
To be honest I have had a number of problems. I found that production is pretty stable, but the branch deploys and local hosting are not.
The bug in my first post is a blocker to using Planetscale, which is essential for most of my API.
I noticed that if I push a local tsconfig.json, it causes my functions to not be able to locate some files relative to the project root. I’ve excluded it in .gitignore.
Just now I tried running netlify dev and the compiler is complaining about all the imports using ‘@’. For example:
This does not occur on my main branch deploy. I tried removing tsconfig.json locally, but this did not help. This wasn’t always happening, though; I just got it now when I was trying stuff out for this writeup.
I had a lot of problems connecting to Netlify Identity using netlify dev also. This might be due to my browser tracking settings. Was able to do it in Chrome but not Firefox. Firefox works fine on my main deploy. Can’t test it now due to the above ‘@’ imports issue.
I remember a few other things blocking me from using branch/local builds, but they’re hard to dig up now because of the above blockers. I know that’s not terribly helpful - I will try to update when I get past them.
If you guys are doing a call or something and would like me to participate I can probably do work that in. I’d also be willing to give 2 of your devs access to my GitHub repo for now, if that would help, provided you agree to not leak anything about the project’s inner workings.
I have an update: I’ve manually copied and pasted all the values into the correct deploy contexts for each of the Planetscale-related environment variables and I’m now able to access my DB branch from a branch deploy!
Great news about being able to finally get this working!
However, I noticed you mentioned above that you’ve been struggling with various different issues with CLI or branch deploys. If you need help with any of those, feel free to open a separate topic so as to not add to this unrelated topic.