-
I setup a custom query hook with Next.js SSR and having an issue where in production there is
This is how the query hook is being used on pages:
That URL is http://localhost:3000/api/v1/sitesettings in dev but in production it is https://domain.com/undefined/api/v1/sitesettings. I can't figure out if I'm missing something that's causing this to occur. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The URL undefined was because I didn't prepend the PROD_URL env variable with NEXT_PUBLIC_ But I also had to change the route to find by Id then in components use the Id in the custom hook so the hook works properly now:
In pages, the Id had to be used too:
|
Beta Was this translation helpful? Give feedback.
The URL undefined was because I didn't prepend the PROD_URL env variable with NEXT_PUBLIC_
But I also had to change the route to find by Id then in components use the Id in the custom hook so the hook works properly now:
In pages, the Id had to be used too: