Error 500 on fetch user, but API returns me data
Hello, I have 500 error, but I dont know why because the API call is good
500
[GET] "https://localhost:9001/api/user": <no response> fetch failed
at async $fetchRaw2 (./node_modules/ofetch/dist/shared/ofetch.00501375.mjs:228:14)
at async $fetch2 (./node_modules/ofetch/dist/shared/ofetch.00501375.mjs:261:15)
at async Module.useApiFetch (./composables/useApiFetch.ts:20:10)
at async Proxy.fetchUser (./stores/authStore.ts:34:24)
at async ./plugins/loadUser.ts:10:85
at async setup (./virtual:nuxt:/home/thibaut/projects/nuxt-3/.nuxt/plugins/server.mjs:40:116)
at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)
at async applyPlugin (./node_modules/nuxt/dist/app/nuxt.js:116:25)
at async executePlugin (./node_modules/nuxt/dist/app/nuxt.js:153:9)
Here is the method called in a loadUser plugin
Here is the console :
GET http://localhost:3000/ 500 (Internal Server Error)
devtools.client.mjs?v=83be3009:51 β¨ Nuxt DevTools Press Shift + Alt + D to open DevTools
authStore.ts:50 RESPONSE {id: 2, email: '[email protected]', scope: Array(2)}
chunk-L5BJSZYY.js?v=83be3009:2898
<Suspense> is an experimental feature and its API will likely change.
backend.js:3301 π "auth" store installed π
1 Reply
Okay, I added NODE_TLS_REJECT_UNAUTHORIZED=0 in .env and now it works