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

[gatsby-source-contentful@next] Missing content when loading multiple Contentful Spaces #26875

Closed
daydream05 opened this issue Sep 12, 2020 · 6 comments
Labels
topic: source-contentful Related to Gatsby's integration with Contentful type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@daydream05
Copy link
Contributor

daydream05 commented Sep 12, 2020

Description

Content and fields are missing when sourcing from multiple content spaces

I'm using the next version of Contentful

Steps to reproduce

yarn add gatsby-source-contentful@next

Then do something like this:

module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-contentful`,
      options: {
        spaceId: `your_space_id`,
        accessToken: process.env.CONTENTFUL_ACCESS_TOKEN,
      },
    },
    {
      resolve: `gatsby-source-contentful`,
      options: {
        spaceId: `your_second_space_id`,
        accessToken: process.env.SECONDARY_CONTENTFUL_ACCESS_TOKEN,
      },
    },
  ],
}

Expected result

The expected result should have the Content Models from the second_space be filled with fields and content.

Actual result

Only the internals show up:
Screen Shot 2020-09-12 at 3 12 40 PM

The contents from the first space is fine but the second space is always messed up.

Environment

System:
    OS: macOS High Sierra 10.13.6
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.10.1 - /usr/local/bin/node
    Yarn: 1.16.0 - ~/.yarn/bin/yarn
    npm: 6.14.8 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 85.0.4183.102
    Firefox: 79.0
    Safari: 13.1.2
  npmPackages:
    gatsby: ^2.24.50 => 2.24.53
    gatsby-image: ^2.4.16 => 2.4.16
    gatsby-plugin-manifest: ^2.4.24 => 2.4.27
    gatsby-plugin-next-seo: ^1.6.1 => 1.6.1
    gatsby-plugin-offline: ^3.2.24 => 3.2.26
    gatsby-plugin-react-helmet: ^3.3.10 => 3.3.10
    gatsby-plugin-react-svg: ^3.0.0 => 3.0.0
    gatsby-plugin-sharp: ^2.6.28 => 2.6.31
    gatsby-plugin-theme-ui: ^0.3.0 => 0.3.0
    gatsby-plugin-web-font-loader: ^1.0.4 => 1.0.4
    gatsby-source-contentful: ^2.3.35-next.63 => 2.3.35-next.63+cfd6dc2ab
    gatsby-source-filesystem: ^2.3.25 => 2.3.27
    gatsby-transformer-sharp: ^2.5.13 => 2.5.14
  npmGlobalPackages:
    gatsby-cli: 2.12.91
@daydream05 daydream05 added the type: bug An issue or pull request relating to a bug in Gatsby label Sep 12, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 12, 2020
@sidharthachatterjee sidharthachatterjee added status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. topic: source-contentful Related to Gatsby's integration with Contentful and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Sep 14, 2020
@sidharthachatterjee
Copy link
Contributor

Could you help us out with a reproduction please? 🙂

@axe312ger
Copy link
Collaborator

The code of the plugin assumes there is only one Contentful source. It would require a significant rewrite to allow multiple spaces as source

@daydream05
Copy link
Contributor Author

@sidharthachatterjee trying to figure out the best way since I would need to expose my api tokens for that. But I think @axe312ger confirms that it doesn't work.

@axe312ger oh got it so I think this should be noted as a breaking change right?

I know a couple of people who are querying multiple spaces into the same website in production.

What would be a better alternative to make multiple spaces work? My client right now wants to crosspost his blog posts to another gatsby website that also uses contentful. I really like the next version and I don't want to downgrade to the old version. Thanks!

@LekoArts LekoArts added type: question or discussion Issue discussing or asking a question about Gatsby and removed status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. type: bug An issue or pull request relating to a bug in Gatsby labels Sep 18, 2020
@alex-tgk
Copy link
Contributor

@sidharthachatterjee trying to figure out the best way since I would need to expose my api tokens for that. But I think @axe312ger confirms that it doesn't work.

@axe312ger oh got it so I think this should be noted as a breaking change right?

I know a couple of people who are querying multiple spaces into the same website in production.

What would be a better alternative to make multiple spaces work? My client right now wants to crosspost his blog posts to another gatsby website that also uses contentful. I really like the next version and I don't want to downgrade to the old version. Thanks!

@daydream05 not an ideal solution, but now that Contentful offers its GraphQL API to all space levels, you could use the gatsby-source-graphql plugin to source from Contentful manually for your second space.

@daydream05
Copy link
Contributor Author

@alex-tgk Oh thank you i'll look into that! That might actually be better since pulling multiple spaces causes field collusions anyway.

@axe312ger
Copy link
Collaborator

We will fix this in #27244 which contains most of the fixes of the rich text canary :)

axe312ger added a commit to axe312ger/gatsby that referenced this issue Oct 2, 2020
axe312ger added a commit to axe312ger/gatsby that referenced this issue Oct 2, 2020
axe312ger added a commit to axe312ger/gatsby that referenced this issue Oct 2, 2020
@pvdz pvdz closed this as completed in 7bf2bdb Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: source-contentful Related to Gatsby's integration with Contentful type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

No branches or pull requests

5 participants