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

Build fails when I have an SSR page and gatsby-source-contentful working together #37632

Closed
2 tasks done
fedehub93 opened this issue Feb 9, 2023 · 7 comments · Fixed by #37660
Closed
2 tasks done
Assignees
Labels
status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. topic: render-mode Related to Gatsby's different rendering modes type: bug An issue or pull request relating to a bug in Gatsby

Comments

@fedehub93
Copy link

Preliminary Checks

Description

When I run the build with gatsby build I receive the ERROR #98001 and Error: Worker exited before finishing task.
I've noticed this problem using the gatsby-source-contentful-plugin with an SSR page.
As I remove the SSR page everything works fine.
Similarly disabling gatsby-source-contentful and leaving the SSR page everything works fine.

I also tested this with gatsby@next.

Reproduction Link

https://github.com/fedehub93/gatsby-contentful-ssr-page

Steps to Reproduce

  1. npm init gatsby, I choose typescript configuration
  2. yarn add gatsby-source-contentful gatsby-plugin-image gatsby-plugin-sharp gatsby-transformer-sharp
  3. configure gatsby-config.ts with plugins and put your spaceId and accessToken in gatsby-source-contentful options:
  plugins: [
    {
      resolve: "gatsby-source-contentful",
      options: {
        spaceId: "<PUT_YOUR_SPACE_ID>",
        accessToken: "<PUT_YOUR_ACCESS_TOKEN>",
      },
    },
    `gatsby-plugin-image`,
    `gatsby-plugin-sharp`,
    `gatsby-transformer-sharp`,
  ],
  1. add a new file in src/pages/search.tsx with following code:
import React from "react";
import { GetServerData, PageProps } from "gatsby";

type ServerDataProps = {
  title: string;
};

const Search = ({
  serverData,
}: PageProps<object, object, unknown, ServerDataProps>): JSX.Element => (
  <h1>{serverData.title}</h1>
);

export default Search;

export const getServerData: GetServerData<ServerDataProps> = async (props) => {
  return {
    props: {
      title: "Test SSR",
    },
  };
};

  1. Run gatsby build

Expected Result

The build runs successfully.

Actual Result

I have this error:

failed Validating Rendering Engines - 1.409s

 ERROR #98001  ENGINE.VALIDATION

Built Rendering Engines failed validation failed validation.

Please open an issue with a reproduction at https://gatsby.dev/new-issue for more help.



  Error: Worker exited before finishing task

  - index.js:205 ChildProcess.<anonymous>
    [test-ssr]/[gatsby-worker]/dist/index.js:205:41

Environment

System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
  Binaries:
    Node: 18.0.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.6.0 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 3.9.7
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (109.0.1518.78)
  npmPackages:
    gatsby: ^5.6.0 => 5.6.0
    gatsby-plugin-image: ^3.6.0 => 3.6.0
    gatsby-plugin-sharp: ^5.6.0 => 5.6.0
    gatsby-source-contentful: ^8.6.0 => 8.6.0
    gatsby-source-filesystem: ^5.6.0 => 5.6.0
    gatsby-transformer-sharp: ^5.6.0 => 5.6.0

Config Flags

No response

@fedehub93 fedehub93 added the type: bug An issue or pull request relating to a bug in Gatsby label Feb 9, 2023
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Feb 9, 2023
@LekoArts LekoArts added status: needs more info Needs triaging and reproducible examples or more information to be resolved status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Feb 13, 2023
@LekoArts
Copy link
Contributor

Hi!

Your issue seems to be similar to #37640 - @tdelgio can you share what caused this in Contentful?

@fedehub93 we won't be able to help you with this reproduction at it seems specific to your Contentful instance. You'd need to create a space which credentials you could share freely.

@fedehub93
Copy link
Author

fedehub93 commented Feb 14, 2023

Hi!

Your issue seems to be similar to #37640 - @tdelgio can you share what caused this in Contentful?

@fedehub93 we won't be able to help you with this reproduction at it seems specific to your Contentful instance. You'd need to create a space which credentials you could share freely.

Hi, thank you for the quick response @LekoArts .

I created a new environment with a new space on contentful to be able to give you some test credentials to reproduce the error.

I have updated my repo in the reproduction link with these new credentials.

The error is also returned to me after creating a very simple content model on contentful with only one field which is a Rich Text Field in my case.

No records added.

@SebastianKoch27
Copy link

Are there any new information about this issue?

@tdelgio
Copy link

tdelgio commented Feb 15, 2023

I downgrade Gatsby and plug-ins versions and it works.
It seems to be a compatibility problem between versions.


  "dependencies": {
    "gatsby": "^4.23.1",
    "gatsby-plugin-gatsby-cloud": "^5.6.0",
    "gatsby-plugin-image": "^2.23.1",
    "gatsby-plugin-manifest": "^5.6.0",
    "gatsby-plugin-offline": "^6.6.0",
    "gatsby-plugin-react-helmet": "^5.0.0",
    "gatsby-plugin-sharp": "^4.23.1",
    "gatsby-source-contentful": "^7.21.1",
    "gatsby-source-filesystem": "^5.6.0",
    "gatsby-transformer-sharp": "^4.23.1",
    "prop-types": "^15.7.2",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-helmet": "^6.1.0"
  },

@LekoArts LekoArts added status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. and removed status: needs more info Needs triaging and reproducible examples or more information to be resolved status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. labels Feb 15, 2023
@LekoArts
Copy link
Contributor

LekoArts commented Feb 15, 2023

We updated babel in #37568 and #37386 which contained this PR: babel/babel#15290. It changes the syntax for dynamic imports which currently breaks the engine creation & validation.

For now, use gatsby-source-contentful@8.3.0 until this is fixed.

@LekoArts LekoArts added the topic: render-mode Related to Gatsby's different rendering modes label Feb 15, 2023
@SebastianKoch27
Copy link

Sorry for this question, but what about testing before deployment. And why this took 6 days to find the issue?

@LekoArts
Copy link
Contributor

A fix for this was published in gatsby-source-contentful@8.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. topic: render-mode Related to Gatsby's different rendering modes type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants