fetch failed
Can someone help me please? I dont understand why I cant call the auth refresh on server side, i kept getting this error
500
[POST] "https://localhost:8080/api/auth/refresh": <no response> fetch failed
at async $fetch2 (/D:/Projects/advance@nuxt3/node_modules/ofetch/dist/shared/ofetch.00501375.mjs:261:15)
at async setup (D:\Projects\advance@nuxt3\node_modules@sidebase\nuxt-auth\dist\runtime\plugins\refresh-token.server.mjs:30:19)
at async setup (D:\Projects\advance@nuxt3\virtual:nuxt:D:\Projects\[email protected]\plugins\server.mjs:44:116)
at async Object.callAsync (/D:/Projects/advance@nuxt3/node_modules/unctx/dist/index.mjs:72:16)
at async applyPlugin (D:\Projects\advance@nuxt3\node_modules\nuxt\dist\app\nuxt.js:116:25)
at async executePlugin (D:\Projects\advance@nuxt3\node_modules\nuxt\dist\app\nuxt.js:153:9)
at async Module.applyPlugins (D:\Projects\advance@nuxt3\node_modules\nuxt\dist\app\nuxt.js:161:5)
at async createNuxtAppServer (D:\Projects\advance@nuxt3\node_modules\nuxt\dist\app\entry.js:26:7)
at async default (/D:/Projects/advance@nuxt3/node_modules/@nuxt/vite-builder/dist/runtime/vite-node.mjs:33:18)
2 Replies
Can you provide more context?
Look like you are using
nuxt-auth
moduleHello, basically Im trying to refresh my token on page reload and also getting the user session. I have api/auth/refresh endpoint but when its called on server its giving this error.
Yep im using nuxt auth, but I tried to implement it first on my own and same issue. Basically what im doing is like nuxtServerInit and then inside the scope, refresh the token and get the user session. But doesnt seem to work.
Im not sure if nuxt already "built" these endpoints on server when the plugin is called