bug(gatsby-source-strapi): When locale: "all" is used in a singleTypes error is thrown on a startup
- Dominant language
- JavaScript
- Stars
- 57
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
## Describe the bug
**When locale: "all" is used in a singleTypes error is thrown on a startup:**
```
singleTypes: [
"bottom-banner",
"footer",
{
singularName: "header",
pluginOptions: {
i18n: {
locale: "all",
},
},
queryParams: {
populate: {
logoMobile: "1",
logoDesktop: "1",
headerItem: {
populate: {
dropdown: "*",
}
}
}
}
},
]
```
**Error text:**
```
ERROR #11321 API.NODE.EXECUTION
"gatsby-source-strapi" threw an error while running the sourceNodes lifecycle:
Cannot read properties of undefined (reading 'status')
62 | const endpoints = (0, _helpers.getEndpoints)(strapiConfig, schemas);
63 | const lastFetched = await cache.get(LAST_FETCHED_KEY);
> 64 | const allResults = await Promise.all(endpoints.map(({
| ^
65 | kind,
66 | ...config
67 | }) => {
File: node_modules/gatsby-source-strapi/dist/gatsby-node.js:64:22
TypeError: Cannot read properties of undefined (reading 'status')
- fetch.js:132 fetchEntity
[frontend_gatsby]/[gatsby-source-strapi]/dist/fetch.js:132:24
```
**I am using strapi v5.6.0, gatsby-source-strapi v5.0.2**
## To Reproduce
1. Add new locale
2. Create a singleType in a Strapi
3. Enable Internalization for this type
4. Create content in multiple locales
5. Add new type gatsby-config.js with ```
pluginOptions: {
i18n: {
locale: "all",
},
},```
6. run gatsby develop
## Expected behavior
No error on startup, graphql request with filter by locale is available
## System Info
```
System:
OS: macOS 14.4.1
CPU: (12) arm64 Apple M2 Max
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.16.0 - /var/folders/5w/b_rt83v54tz645mqrk24q47h0000gn/T/yarn--1736760325745-0.9108832253904138/node
Yarn: 1.22.21 - /var/folders/5w/b_rt83v54tz645mqrk24q47h0000gn/T/yarn--1736760325745-0.9108832253904138/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
Browsers:
Chrome: 131.0.6778.265
Safari: 17.4.1
npmPackages:
gatsby: ^5.14.1 => 5.14.1
gatsby-plugin-image: ^3.14.0 => 3.14.0
gatsby-plugin-manifest: ^5.14.0 => 5.14.0
gatsby-plugin-sass: ^6.14.0 => 6.14.0
gatsby-plugin-sharp: ^5.14.0 => 5.14.0
gatsby-source-filesystem: ^5.14.0 => 5.14.0
gatsby-source-graphql: ^5.14.0 => 5.14.0
gatsby-source-strapi: ^5.0.2 => 5.0.2
gatsby-transformer-remark: ^6.14.0 => 6.14.0
gatsby-transformer-sharp: ^5.14.0 => 5.14.0
```
Contributor guide
Assessment
This issue has not been assessed yet.