When using Strapi v5, the module may throw undefined instead of a valid error object when a request fails (e.g. network/SSL error).
This causes a crash in Nitro during SSR:
Cannot read properties of undefined (reading 'statusText')
Version
@nuxtjs/strapi: 2.1.1
nuxt: 4.4.2
Reproduction Link
https://github.com/kong-dev/reproductions/tree/main/nuxt-modules-strapi-v5-throws-undefined
Steps to reproduce
npx tiged kong-dev/reproductions/nuxt-modules-strapi-v5-throws-undefined reproduction
cd reproduction
pnpm install
pnpm dev
- open browser
What is Expected?
The app should build and run without errors.
What is actually happening?
The app crashes.
Root cause
In useStrapiClient, errors are resolved with:
const e = err.data || defaultErrors(err)[version]
However, defaultErrors only defines v3 and v4.
When using Strapi v5, the module may throw
undefinedinstead of a valid error object when a request fails (e.g. network/SSL error).This causes a crash in Nitro during SSR:
Version
@nuxtjs/strapi: 2.1.1
nuxt: 4.4.2
Reproduction Link
https://github.com/kong-dev/reproductions/tree/main/nuxt-modules-strapi-v5-throws-undefined
Steps to reproduce
npx tiged kong-dev/reproductions/nuxt-modules-strapi-v5-throws-undefined reproductioncd reproductionpnpm installpnpm devWhat is Expected?
The app should build and run without errors.
What is actually happening?
The app crashes.
Root cause
In useStrapiClient, errors are resolved with:
However, defaultErrors only defines v3 and v4.