gatsby-uc / plugins

Monorepo for plugins in the Gatsby User Collective.
https://gatsbyuc.dev
MIT License
58 stars 34 forks source link

Source Strapi v5 doesn't contain any fields in types #480

Open AlexanderProd opened 3 weeks ago

AlexanderProd commented 3 weeks ago

Describe the bug

I'm using the Strapi v5 version of gatsby-source-strapi (#478) with yarn link.

The collection and single Strapi types configured in my gatsby-config.js are found but they do not contain any fields. Even though the fields exist and are populated in my Strapi instance. When I use gatsby-source-strapi@1.0.3 the fields on the same types are found.

This is the error I'm getting:

 ERROR #12100  API.TYPESCRIPT.TYPEGEN

There was an error while trying to generate TS types from your GraphQL queries:

    Error: GraphQL Document Validation failed with 1 errors;
  Error 0: Cannot query field "Titel" on type "STRAPI_IMMO_LEADS_PAGE".
    at GraphQL request:6:11

See our docs page for more info on this error: https://gatsby.dev/graphql-typegen

failed Generating GraphQL and TypeScript types - 0.161s

The result from the stapi api when fetching the same single type:

Bildschirmfoto 2024-09-29 um 10 45 43

The type in the GraphiQL explorer:

image

To Reproduce

Steps to reproduce the behavior:

  1. Create a single type in strapi
  2. Add content to the single type and publish it
  3. Connect gatsby-source-strapi with the strapi instance.
  4. Check out the types in GraphiQL workbench.
  5. The types are there but edges -> node doesn't contain any fields.

Expected behavior

The Strapi types should contain fields.

System Info

Please provide information about your site via these means as possible:

gatsby info:

System:
    OS: macOS 15.0
    CPU: (10) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.20.3 - /private/var/folders/sg/7qlzh78n07d0n3v6bzh_twch0000gn/T/xfs-aa16fd5b/node
    Yarn: 4.0.2 - /private/var/folders/sg/7qlzh78n07d0n3v6bzh_twch0000gn/T/xfs-aa16fd5b/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v18.20.3/bin/npm
  Browsers:
    Chrome: 129.0.6668.70
    Safari: 18.0
  npmPackages:
    gatsby: ^5.13.7 => 5.13.7
    gatsby-plugin-emotion: ^8.13.1 => 8.13.1
    gatsby-plugin-google-gtag: ^5.13.1 => 5.13.1
    gatsby-plugin-image: ^3.13.1 => 3.13.1
    gatsby-plugin-manifest: ^5.13.1 => 5.13.1
    gatsby-plugin-mdx: ^5.13.1 => 5.13.1
    gatsby-plugin-schema-snapshot: ^4.13.0 => 4.13.0
    gatsby-plugin-sharp: ^5.13.1 => 5.13.1
    gatsby-plugin-sitemap: ^6.13.1 => 6.13.1
    gatsby-source-filesystem: ^5.13.1 => 5.13.1
    gatsby-source-strapi: ^3.3.3 => 4.0.0
    gatsby-transformer-sharp: ^5.13.1 => 5.13.1
  npmGlobalPackages:
    gatsby: 5.13.7

The update flag in gatsby-plugin-schema-snapshot is set to true.

laurenskling commented 1 week ago

@AlexanderProd if you came from 1.0.3, you came from Strapi v3. Are you sure you ment that?

We debug endpoints on the command line, are you sure these calls are returning your data correctly?

I don't know about gatsby-plugin-schema-snapshot, maybe that clashes? Did you fully clean all caches?

Did you set version: 5 on your config?