Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(gatsby-source-strapi): When locale: "all" is used in a singleTypes error is thrown on a startup #509

Open
alexanderT119 opened this issue Jan 13, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@alexanderT119
Copy link

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 

@alexanderT119 alexanderT119 added the bug Something isn't working label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant