How do you change the compute host for the Neon main branch?
For security purposes, I want to change the compute host, i.e. the auto-generated subdomain.
The only workaround I can see is to delete the main branch and push the main branch again so that Neon detects that the main branch exists again.
22 Replies
crude-lavenderOP•2y ago
So taking the example from Neon docs,
https://neon.tech/docs/connect/connect-from-any-app
postgres://alex:AbC123dEf@ep-cool-darkness-123456.us-east-2.aws.neon.tech/dbname
I want to stop using cool-darkness and use a different host
Neon
Connect from any application - Neon Docs
When connecting to Neon from an application or client, you connect to a database in your Neon project. In Neon, a database belongs to a branch, which may be the primary branch of your project (main) o...
crude-lavenderOP•2y ago
The pw can remain
My app has not launched so I'm willing to delete things.
As a less urgent question: how would I accomplish this if my app were live in production?
crude-lavenderOP•2y ago
On a separate note, the UX allows me to delete the main branch without first setting a different branch as primary. That might be a bug, or maybe I am misunderstanding the UX

rare-sapphire•2y ago
Can you elaborate on your security requirements and threat model for me?
crude-lavenderOP•2y ago
Ah, I am embarrassed. The connection string got compromised. I already changed pw. But I noticed that subdomain is the same even after changing the pw and disconnecting and removing the Vercel Neon integration
fascinating-indigo•2y ago
You need to delete and recreate the compute endpoint to get a new hostname.
crude-lavenderOP•2y ago
Do you have a screenshot of how to do that in the free plan because I don't see an option to do that in the "Edit compute endpoint" side menu
fascinating-indigo•2y ago

crude-lavenderOP•2y ago
Thanks, I deleted the compute per your screenshot, but can I, on the free plan, add a compute endpoint?
crude-lavenderOP•2y ago

crude-lavenderOP•2y ago
If not, should I just delete the main branch and then push the main branch again so that Neon detects the main branch via the Vercel integration?
Separate non-urgent question: What's a fast way to change the password for the main branch? I went through the "Reset password" workflow on the Project Dashboard. It worked, but it took me over ten minutes to do everything: Update my local repo, test, disconnect the Vercel integration from Neon, remove Neon integration from Vercel, and then add the Neon integration in Vercel, and push to main. I assume all this time would be downtime for my app.
Can a branch have multiple working passwords?
fascinating-indigo•2y ago
Thanks, I deleted the compute per your screenshot, but can I, on the free plan, add a compute endpoint?Absolutely, you should be able to have a compute associated with your main/primary. This looks like a possible bug. I'll raise it internally.
Separate non-urgent question: What's a fast way to change the password for the main branch? I went through the "Reset password" workflow on the Project Dashboard. It worked, but it took me over ten minutes to do everything: Update my local repo, test, disconnect the Vercel integration from Neon, remove Neon integration from Vercel, and then add the Neon integration in Vercel, and push to main. I assume all this time would be downtime for my app.I don't think you should need to disconnect the Vercel integration to propagate the new password, did Vercel not get updated? In terms of fastest way to reset, you could script it using the Neon REST API: https://api-docs.neon.tech/reference/resetprojectbranchrolepassword
Neon
Reset the role password
Resets the password for the specified role.Returns a new password and operations. The new password is ready to use when the last operation finishes.The old password remains valid until last operation finishes.Connections to the compute endpoint are dropped. If idle,the compute endpoint becomes activ...
fascinating-indigo•2y ago
Can a branch have multiple working passwords?Yep. It'll be the passwords for all roles/users in that branch.
crude-lavenderOP•2y ago
No, Vercel didn’t get updated upon resetting the password
Thanks, good to know about the script
From my read of that scripts documentation, it is essentially the same as the Reset Password. I probably wouldn’t do that in production since I want to keep other parts of the tech stack working while I make password changes. The spirit of what I was asking was how do I make my entire tech stack change to a new Neon password without downtime? I’m thinking I would make a role and use its new password and change Vercel and so on.
By the way, through this exercise, I think I found a bug where manually changing the password in Vercel environment variables did not make a successful connection to Neon. I didn’t troubleshoot it or log evidence of the bug
And I had previously set up the Vercel environment variables automatically through the Vercel Neon integration
fascinating-indigo•2y ago
Ah that context helps. Yeah, in that case you’d need a new role and gradually update each service to use it I suppose.
Hmm, I wonder was it a) the Vercel deployment was still using the old value b) the value you entered manually was overwritten by the integration c) ??
crude-lavenderOP•2y ago
I think A. I didn’t see any overwriting. I resolved the issue by pushing to main branch
fascinating-indigo•2y ago
Ah so you need to do a redeploy for vercel to use the new values I guess. Weird…
crude-lavenderOP•2y ago
Well, the resolution entailed: I removed and deleted the neon integration from Vercel.
And added the neon integration. And then pushed to main
crude-lavenderOP•2y ago
Since I deleted my compute, I can't add one again. Can someone direct message me so that I can give them my branch identifiers so that a new compute can be added?
I tried to delete and recreate the main branch. But validation prevents me from deleting the main branch.

crude-lavenderOP•2y ago
Pushing to main branch in Github (and so Vercel) didn't add a compute to the Neon main branch
fascinating-indigo•2y ago
@Matt Luo I DM'd you
crude-lavenderOP•2y ago
Thanks to Evan's help, this issue is resolved.