strapi / strapi-starter-next-blog

Strapi Starter Next Blog
https://strapi-starter-next-blog-pearl.vercel.app/
MIT License
383 stars 145 forks source link

> Build error occurred : TypeError: Only absolute URLs are supported at getNodeRequestOptions #16

Open maurocolella opened 4 years ago

maurocolella commented 4 years ago

Hi,

I have religiously followed the instructions to deploy Strapi with Next.js on Heroku and Vercel, respectively.

My Heroku instance works fine, but when deploying to Vercel, either from command-line, or from UI by clicking the button, I get:

> Build error occurred : TypeError: Only absolute URLs are supported at getNodeRequestOptions 

Please advise.

tathagatbanerjee commented 4 years ago

You have to change the URL in frontend/pages/article/[id].js and frontend/lib/api.js to API_URL.

image

maurocolella commented 4 years ago

Thanks, but shouldn't this be covered by the config? process.env, for both files.

I see also that the env var is now NEXT_PUBLIC_API_URL.

Mcastres commented 4 years ago

Hello @maurocolella,

If you want to test it locally, you'll need to create a .env.local file containing the API_URL variable. On Vercel simply use secret to store your API_URL. The now.json file does the rest :)

maurocolella commented 4 years ago

But it doesn't. Like I said, I followed the guidelines for this religiously.

I will try to re-deploy with the latest code, but I think something is not right with that part of the workflow.

On Thu, Jun 25, 2020 at 23:30 Maxime Castres notifications@github.com wrote:

Hello @maurocolella https://github.com/maurocolella,

If you want to test it locally, you'll need to create a .env.local file containing the API_URL variable. On Vercel simply use secret to store your API_URL. The now.json file does the rest :)

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/strapi/strapi-starter-next-blog/issues/16#issuecomment-649625298, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFZ7NB7YETQYD6UPTM2ZMDRYNURPANCNFSM4ODGFN3A .

AarRidho commented 4 years ago

Hello, it seems that you are hosting 1 vercel for Backend and Frontend?

getStaticProps runs at build time. So technically, you can't fetch data at build time while the backend is not ready yet (because they are served in 1 vercel deployment).

maurocolella commented 4 years ago

The problem is not with what I do. What I do is git clone and deploy. The problem is with what I clone.

On Fri, Nov 6, 2020 at 19:17 Ridho Aru notifications@github.com wrote:

Hello, it seems that you are hosting 1 vercel for Backend and Frontend?

getStaticProps runs at build time. So technically, you can't fetch data at build time while the backend is not ready yet (because they are served in 1 vercel deployment).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/strapi/strapi-starter-next-blog/issues/16#issuecomment-723026245, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFZ7NE2HCCRU47O6I676E3SOPLNFANCNFSM4ODGFN3A .

gusdarma commented 2 years ago

I had this issue too, and got the solution.

In my case If you use hidden variables on local you need to set that hidden variables too on Vercel's project. You can go to "Environment Variables", please check here : https://vercel.com/docs/concepts/projects/environment-variables

Goodluck!

maurocolella commented 2 years ago

@gusdarma , I am well-aware of how to configure env vars. On my local and on Vercel.

I reported this to indicate that whichever directions were given to run it on Vercel weren't working. Simply. Documentation bugs also count as bugs.

That said, thank you for trying to help.