Error: Only absolute urls are supported
See original GitHub issueHello, i get this error when i am trying this:
path: '/news',
children: [
{
path: '/',
action() {
return {
component: <Layout><News /></Layout>,
};
}
},
{*/
path: '*',
async action({ path, store }) {
try {
await store.dispatch(loadSelectedNews({ path }));
debugger
const data = store.getState().selectedNews;
return {
component: <Layout><Content content={data} /></Layout>,
};
} catch (e) {
throw new Error(e);
}
},
},]
};
Is this error because i am using dynamic path as nested of parent /news?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Next.js - Error: only absolute urls are supported
It means you are trying to export data and NextJS does not support fetching data from pages/api/* directory. To avoid errors, its better...
Read more >Error: only absolute urls are supported · Issue #481
It looks like there's something wrong with the URL in the fetch method. For me, it solved by changing url in the fetch...
Read more >TypeError Only absolute URLs are supported
It looks like it expects other environment variables (e.g. that contain the subscription key), as well.
Read more >When trying to deploy to Vercel: TypeError: Only absolute ...
When trying to deploy to Vercel: TypeError: Only absolute URLs are supported : r/nextjs.
Read more >Netlify Dev - TypeError: Only absolute URLs are supported
I am using Nuxt. For a new feature I need to start using Netlify functions. In order to run everything locally I started...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Do you have
import fetch from '../../core/fetch';
at the top of this file?This module uses whatwg-fetch and node-fetch polyfills on client and server side respectively.
Protocol and hostname should be always specified in the url for
node-fetch
, and our isomorphic src/core/fetch module resolves this problem, just use it instead ofwhatwg-fetch
/node-fetch
orisomorphic-fetch
.No, nested wildcard routes e.g. { path: ‘*’, … } should work fine. Playground: https://jsfiddle.net/frenzzy/220eq2sv/
But need to remember that
path
insideaction
method is relative to the parent route:Also need to remember about url encoding:
And if you need the original url inside your
action
method, you can pass it down via router:looks like in your example
loadSelectedNews()
throws an error, so need to exactly know what this function expects, can you provide an example?