strapi-starter-next-blog icon indicating copy to clipboard operation
strapi-starter-next-blog copied to clipboard

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

Open maurocolella opened this issue 4 years ago • 8 comments

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.

maurocolella avatar Jun 20 '20 03:06 maurocolella

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

image

tathagatbanerjee avatar Jun 24 '20 04:06 tathagatbanerjee

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.

maurocolella avatar Jun 24 '20 05:06 maurocolella

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 :)

Mcastres avatar Jun 25 '20 15:06 Mcastres

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 [email protected] 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 .

maurocolella avatar Jun 25 '20 23:06 maurocolella

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).

AarRidho avatar Nov 06 '20 11:11 AarRidho

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 [email protected] 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 .

maurocolella avatar Nov 06 '20 11:11 maurocolella

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!

gusdarma avatar Dec 09 '21 09:12 gusdarma

@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.

maurocolella avatar Dec 09 '21 10:12 maurocolella