Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

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

Open
maurocolella opened this issue Jun 20, 2020 · 8 comments

Comments

@maurocolella
Copy link

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
Copy link

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

image

@maurocolella
Copy link
Author

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
Copy link
Contributor

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
Copy link
Author

maurocolella commented Jun 25, 2020 via email

@AarRidho
Copy link

AarRidho commented Nov 6, 2020

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
Copy link
Author

maurocolella commented Nov 6, 2020 via email

@gusdarma
Copy link

gusdarma commented Dec 9, 2021

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
Copy link
Author

maurocolella commented Dec 9, 2021

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants