scaffold-eth-2 icon indicating copy to clipboard operation
scaffold-eth-2 copied to clipboard

Vercel CLI gives gated link instead of public URL

Open technophile-04 opened this issue 10 months ago • 3 comments

Description :

When you deploy the frontend through CLI, vercel seems to output an gated link in CLI, example :

Screenshot 2024-04-09 at 3 26 46 PM

https://wagmiv2-test-cm4cx4xpi-technophile04s-projects.vercel.app <= If you try to open this link, it will tell you to login to vercel / unauthorized.

Although vercel outputs gated link in CLI, one can guess the public URL since it mostly always follow this convention :

{projectName}.vercel.app in my case I named the project as wagmiv2-test so https://wagmiv2-test.vercel.app

Not sure what's the best way to handle this, maybe mentioning this about doc or somewhere.


https://www.youtube.com/live/uhTkEq70lls?si=5Cc6qd6wgB5K55MI&t=1766

^ Even in above video when Austin clicked the generated link it showed "Authenticating"

Instead the actual public link URL should have been https://scalingethdemo.vercel.app i.e his {projectName}.vercel.app

technophile-04 avatar Apr 09 '24 10:04 technophile-04

I found that deployment protection can be changed/disabled only per project , so one of the (bad) options is to go to project settings on vercel and disable it manually for every project

Although vercel outputs gated link in CLI, one can guess the public URL since it mostly always follow this convention : {projectName}.vercel.app in my case I named the project as wagmiv2-test so https://wagmiv2-test.vercel.app/

it works only if no one used that projectName. For example I tried wagmiv2-test too and my URL is https://wagmiv2-test-five.vercel.app/.

So I think best way is to go to vercel dashboard using inspect link from CLI and get public URL here Снимок экрана 2024-04-09 в 14 04 56

rin-st avatar Apr 09 '24 12:04 rin-st

So I think best way is to go to vercel dashboard using inspect link from CLI and get public URL here

Yup agree, maybe we should mention this in docs and maybe we could even add "echo" a note after vercel cli is done logging the output

technophile-04 avatar Apr 10 '24 09:04 technophile-04

So I think best way is to go to vercel dashboard using inspect link from CLI and get public URL here

Yup agree, maybe we should mention this in docs and maybe we could even add "echo" a note after vercel cli is done logging the output

The note after the Vercel log sounds like a good option!

damianmarti avatar Apr 10 '24 13:04 damianmarti

Current vercel output is

$ yarn vercel       
Vercel CLI 32.7.2
🔍  Inspect: https://vercel.com/rinsts-projects/my-awesome-se-2-app/21Q3p1RdcRfyHqggYzFQGUzquuYz [3s]
✅  Preview: https://my-awesome-se-2-46ppd28o7-rinsts-projects.vercel.app [3s]
📝  To deploy to production (my-awesome-se-2-app.vercel.app), run `vercel --prod`

So what you see inside parentheses on the last line my-awesome-se-2-app.vercel.app is the public URL. But it shows last deployed --prod version, or last deployed dev version if no --prod version deployed.

So the Option 1.a is always use --prod for deployments you need to share and then use the link from parentheses. We can mention it in the docs. Update: it already added

Option 1.b is never deploy the app using --prod, so last dev version will be accessible by link in parentheses. Bad, since deployed dev versions could change very often


Note:

I never read that last line with prod url 🤦 (or is it relatively new?) and tried to make the script to get that URL, but it's useless since that link is already mentioned. But it's possible to retrieve last app URL for example using vercel project list and finding it inside output

image

Option 2 - Disable deployment protection per project. Doesn't work from cli so user need to do it by hand :(

Vercel dashboard -> Your project -> Settings -> Deployment protection -> Vercel authentication -> Disabled image

Example: https://my-awesome-se-2-46ppd28o7-rinsts-projects.vercel.app/ - random dev version available without logging in https://my-awesome-se-2-app.vercel.app/ - prod version


To sum up, I think Option 1.a is good enough and easy to use for example for meetups/events where a link needs to be shared. And because of it already works we can close the issue?

rin-st avatar Dec 06 '24 13:12 rin-st

To sum up, I think Option 1.a is good enough and easy to use for example for meetups/events where a link needs to be shared. And because of it already works we can close the issue?

Yes, it seems the way to go. The dev deployments are private by default, if you want to share a deployment you have to deploy it to prod or give access to the dev env, it makes sense.

Btw, when I deployed a project for the first time with yarn vercel, I got this link:

Production: https://test-vercel-9ydjyytz4-damianmartigmailcoms-projects.vercel.app

But this is a private link.

If I go to Vercel, I can get the public url.

If I deploy the same project with yarn vercel --prod, I got:

Production: https://test-vercel-rh1h7bqdl-damianmartigmailcoms-projects.vercel.app

Another private link.

I'm using Vercel CLI 39.1.3.

I'm not getting the public URL, even if I'm using --prod to deploy.

Another issue is that not always the public default URL is {projectName}.vercel.app. It seems like the project name is unique only inside each Vercel account, so Vercel will add a suffix if there is another project using this URL.

Maybe we can explain better how these URLs work in the deployment doc page https://docs.scaffoldeth.io/deploying/deploy-nextjs-app

damianmarti avatar Jan 15 '25 20:01 damianmarti

And I don't get any Public url information when deploying with --prod or without it.

damianmarti avatar Jan 15 '25 20:01 damianmarti