Open erezrokah opened 4 years ago
I've run to this same issue but my setup doesn't have TypeScript. The problem also apparently happens in this repository that uses JavaScript: https://github.com/equk/equk-gatsby#postbuild. In my case, the error showed up once I tried to import font declaration CSS files, e.g. eb-garamond:
import '@fontsource/eb-garamond/400.css';
The error comes withgatsby build
but not when running gatsby develop
. I tried adding the import in my layout file or gatsby-browser.js
, both had the same result.
Describe the bug Context: https://community.netlify.com/t/netlify-cms-is-throwing-a-callback-has-already-been-called-error/20515/4
Gatsby project fails when using the CMS plugin with a TypeScript setup
To Reproduce
To reproduce:
git clone https://github.com/NovySolutions/test-repo
cd test-repo
npm ci
mkdir src/static
to add a missing directorynpm run build
See that the build fails with
Error: Callback was already called
Expected behavior The build should not fail
Applicable Versions:
CMS configuration
https://github.com/NovySolutions/test-repo/blob/1d8f4c1c953781903d4509c2a7a9f9eadfbaf676/src/cms/cms.ts#L7
Additional context
Removing
registerPreviewTemplate
: https://github.com/NovySolutions/test-repo/blob/1d8f4c1c953781903d4509c2a7a9f9eadfbaf676/src/cms/cms.ts#L5or the style imports: https://github.com/NovySolutions/test-repo/blob/1d8f4c1c953781903d4509c2a7a9f9eadfbaf676/src/components/layout-components/layout.tsx#L3
Fixes the issue.
We should probably look at how gatsby-plugin-scss-typescript works and verify we're not doing anything weird here: https://github.com/gatsbyjs/gatsby/blob/90e66c7fcdc7a75185bdaa336b0f9bdec9762585/packages/gatsby-plugin-netlify-cms/src/gatsby-node.js#L116