gatsbyjs/gatsby

gatsby-source-contentful with DSG on a page giving error when accessed from Vercel

7sferry opened this issue · 0 comments

Preliminary Checks

Description

When using Gatsby Source Contentful plugin and apply DSG on a page that using Graphql from Contentful on Vercel, then that page will be error. If DSG applied to a page without Graphql from Contentful, it can be viewed without error.

Reproduction Link

https://github.com/7sferry/contentful-gatsby-reproduction

Steps to Reproduce

  1. use "gatsby-source-contentful": "^8.13.1" plugin
  2. render a page using DSG that contains GraphQL from Contentful like:
query ArchiveQuery {
    allContentfulBlogPost(sort: { publishDate: DESC }) {
      nodes {
        slug
        title
        publishDate
      }
    }
  }
  1. deploy it on vercel.
  2. access that page and it will result error 500.

Expected Result

DSG page run without error with contentful on vercel and the page can be viewed

Actual Result

the page with DSR that contains graphql from contentful cannot be viewed and the runtime log writes:
error "gatsby-source-contentful" threw an error while running the createSchemaCustomization lifecycle:
ENOENT: no such file or directory, mkdir '/var/task/.cache/caches-lmdb'
�[0m
�[0m �[0m�[97m�[41mError�[0m�[37m�[41m:�[0m�[37m�[41m �[0m�[97m�[41mENOENT: no such file or directory, mkdir '/var/task/.cache/caches-lmdb'�[0m �[0m
�[0m �[0m�[90m-�[0m �[0m�[93mnode:fs�[0m�[90m:�[0m�[93m1373�[0m�[37m �[0m�[37mObject.mkdirSync�[0m
�[0m �[0m �[0m�[90mnode:fs:1373:26�[0m
�[0m �[0m
�[0m �[0m�[90m-�[0m �[0m�[93mindex.js�[0m�[90m:�[0m�[93m2224�[0m�[37m �[0m�[37mopen�[0m
�[0m �[0m �[0m�[90m/var/task/.cache/query-engine/index.js:2224:6�[0m
�[0m �[0m
�[0m �[0m�[90m-�[0m �[0m�[93mindex.js�[0m�[90m:�[0m�[93m142�[0m�[37m �[0m�[37mFunction.getStore�[0m
�[0m �[0m �[0m�[90m/var/task/.cache/query-engine/index.js:142:29�[0m
�[0m �[0m
�[0m �[0m�[90m-�[0m �[0m�[93mindex.js�[0m�[90m:�[0m�[93m153�[0m�[37m �[0m�[37mGatsbyCacheLmdb.getDb�[0m
�[0m �[0m �[0m�[90m/var/task/.cache/query-engine/index.js:153:33�[0m
�[0m �[0m
�[0m �[0m�[90m-�[0m �[0m�[93mindex.js�[0m�[90m:�[0m�[93m164�[0m�[37m �[0m�[37mGatsbyCacheLmdb.set�[0m
�[0m �[0m �[0m�[90m/var/task/.cache/query-engine/index.js:164:16�[0m
�[0m �[0m
�[0m �[0m�[90m-�[0m �[0m�[93mindex.js�[0m�[90m:�[0m�[93m298372�[0m�[37m �[0m�[37mgetContentTypesFromContentful�[0m
�[0m �[0m �[0m�[90m/var/task/.cache/query-engine/index.js:298372:15�[0m
�[0m �[0m
�[0m �[0m�[90m-�[0m �[0m�[93mtask_queues�[0m�[90m:�[0m�[93m95�[0m�[37m �[0m�[37mprocessTicksAndRejections�[0m
�[0m �[0m �[0m�[90mnode:internal/process/task_queues:95:5�[0m
�[0m �[0m
�[0m �[0m�[90m-�[0m �[0m�[93mindex.js�[0m�[90m:�[0m�[93m298393�[0m�[37m �[0m�[37mModule.createSchemaCustomization�[0m
�[0m �[0m �[0m�[90m/var/task/.cache/query-engine/index.js:298393:24�[0m
�[0m �[0m
�[0m �[0m�[90m-�[0m �[0m�[93mindex.js�[0m�[90m:�[0m�[93m261017�[0m�[37m �[0m�[37mrunAPI�[0m
�[0m �[0m �[0m�[90m/var/task/.cache/query-engine/index.js:261017:16�[0m
�[0m �[0m
�[0m
Unhandled Rejection: Error: Schema must contain uniquely named types but contains multiple types named "ImageResizingBehavior".
at new GraphQLSchema (/var/task/.cache/query-engine/index.js:97724:15)
at SchemaComposer.buildSchema (/var/task/.cache/query-engine/index.js:121218:16)
at addCustomResolveFunctions (/var/task/.cache/query-engine/index.js:272943:45)
at updateSchemaComposer (/var/task/.cache/query-engine/index.js:272322:9)
at buildSchema (/var/task/.cache/query-engine/index.js:272218:3)
at build (/var/task/.cache/query-engine/index.js:30354:18)
at GraphQLEngine._doGetRunner (/var/task/.cache/query-engine/index.js:363721:7)
Unhandled Rejection: Error: Schema must contain uniquely named types but contains multiple types named "ImageResizingBehavior".
at new GraphQLSchema (/var/task/.cache/query-engine/index.js:97724:15)
at SchemaComposer.buildSchema (/var/task/.cache/query-engine/index.js:121218:16)
at addCustomResolveFunctions (/var/task/.cache/query-engine/index.js:272943:45)
at updateSchemaComposer (/var/task/.cache/query-engine/index.js:272322:9)
at buildSchema (/var/task/.cache/query-engine/index.js:272218:3)
at build (/var/task/.cache/query-engine/index.js:30354:18)
at GraphQLEngine._doGetRunner (/var/task/.cache/query-engine/index.js:363721:7)
Node.js process exited with exit status: 128. The logs above can help with debugging the issue.
Unknown application error occurred

Environment

System:
    OS: Linux 5.10 Amazon Linux 2023
    CPU: (2) x64 Intel(R) Xeon(R) Processor @ 2.90GHz
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 20.12.2 - /node20/bin/node
    Yarn: 4.1.1 - /yarn1/node_modules/yarn/bin/yarn
    npm: 10.5.0 - /node20/bin/npm
  npmPackages:
    gatsby: ^5.13.3 => 5.13.4 
    gatsby-plugin-algolia: ^1.0.3 => 1.0.3 
    gatsby-plugin-catch-links: ^5.13.1 => 5.13.1 
    gatsby-plugin-google-analytics-data-reporting-api: ^1.3.1 => 1.3.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-offline: ^6.13.1 => 6.13.2 
    gatsby-plugin-purgecss: ^6.2.1 => 6.2.1 
    gatsby-plugin-sharp: ^5.13.1 => 5.13.1 
    gatsby-plugin-sitemap: ^6.13.1 => 6.13.1 
    gatsby-remark-images-contentful: ^6.13.1 => 6.13.1 
    gatsby-remark-prismjs: ^7.13.1 => 7.13.1 
    gatsby-source-contentful: ^8.13.1 => 8.13.1 
    gatsby-source-filesystem: ^5.13.1 => 5.13.1 
    gatsby-transformer-remark: ^6.13.1 => 6.13.1 
    gatsby-transformer-sharp: ^5.13.1 => 5.13.1

Config Flags