imgix / gatsby

A simple yet powerful integration between Gatsby and imgix
BSD 2-Clause "Simplified" License
30 stars 6 forks source link

ERROR @imgix/gatsby not working at all at build proccess #270

Closed hazzyeer closed 1 year ago

hazzyeer commented 1 year ago

@imgix/gatsby is not working any more on build process using the command gatsby build. I have the following error:

info [@imgix/gatsby] Loaded plugin.                                                                                                                                                                                                                                                                                     
success onPreInit - 0.011s
success initialize cache - 0.059s
success copy gatsby files - 0.155s
success Compiling Gatsby Functions - 0.235s
success onPreBootstrap - 0.895s

 ERROR #11321  PLUGIN

"@imgix/gatsby" threw an error while running the createSchemaCustomization lifecycle:

Cannot read properties of undefined (reading 'slice')

  145 |
  146 |   // Create the imgix GraphQL types, which will be added to the schema later
> 147 |   const typesAndFields = buildImgixGatsbyTypes<{ rawURL: string }>({
      |                                               ^
  148 |     cache: gatsbyContext.cache,
  149 |     imgixClient,
  150 |     resolveUrl: prop('rawURL'),

File: node_modules\@imgix\gatsby\src\modules\gatsby-plugin\gatsby-node.ts:147:47

  TypeError: Cannot read properties of undefined (reading 'slice')

  - graphqlTypes.ts:57
    [youmni-front]/[@imgix]/gatsby/src/modules/gatsby-plugin/graphqlTypes.ts:57:35

  - Array.reduce

  - graphqlTypes.ts:24 ImgixParamsInputType
    [youmni-front]/[@imgix]/gatsby/src/modules/gatsby-plugin/graphqlTypes.ts:24:54

  - typeBuilder.ts:55 buildImgixGatsbyTypes
    [youmni-front]/[@imgix]/gatsby/src/modules/gatsby-plugin/typeBuilder.ts:55:47

  - gatsby-node.ts:147
    [youmni-front]/[@imgix]/gatsby/src/modules/gatsby-plugin/gatsby-node.ts:147:47

  - gatsby-node.js:33 step
    [youmni-front]/[@imgix]/gatsby/dist/modules/gatsby-plugin/gatsby-node.js:33:23

  - gatsby-node.js:14 Object.next
    [youmni-front]/[@imgix]/gatsby/dist/modules/gatsby-plugin/gatsby-node.js:14:53

  - gatsby-node.js:8
    [youmni-front]/[@imgix]/gatsby/dist/modules/gatsby-plugin/gatsby-node.js:8:71

  - new Promise

  - gatsby-node.js:4 __awaiter
    [youmni-front]/[@imgix]/gatsby/dist/modules/gatsby-plugin/gatsby-node.js:4:12

  - gatsby-node.ts:125 Object.createSchemaCustomization
    [youmni-front]/[@imgix]/gatsby/src/modules/gatsby-plugin/gatsby-node.ts:125:11

  - api-runner-node.js:430 runAPI
    [youmni-front]/[gatsby]/src/utils/api-runner-node.js:430:22

  - api-runner-node.js:581 Promise.catch.decorateEvent.pluginName
    [youmni-front]/[gatsby]/src/utils/api-runner-node.js:581:13

  - debuggability.js:384 Promise._execute
    [youmni-front]/[bluebird]/js/release/debuggability.js:384:9

  - promise.js:518 Promise._resolveFromExecutor
    [youmni-front]/[bluebird]/js/release/promise.js:518:18

  - promise.js:103 new Promise
    [youmni-front]/[bluebird]/js/release/promise.js:103:10

not finished createSchemaCustomization - 0.124s

After investigation, the source of the problem is due to the latest changes to the imgix-url-params pacakge with the version 11.15.0. A rollback to the version 11.13.1 solved the problem. I believe that the exception thrown after calling the slice method as mentioned in the error is caused by the lack of short_description for the parameter parameters node in this json file.

I used the versions 1.7.7 and 2.1.2 of @imgix/gatsby, the same problem.

hazzyeer commented 1 year ago

WORKAROUND

Rollback to the version 11.13.1 of imgix-url-params. To do so, add this to your package.jsonfile:

"overrides": {
    "@imgix/gatsby": {
      "imgix-url-params": "11.13.1"
    }
},
luqven commented 1 year ago

Hey @hazzyeer 👋🏼 , thanks for opening this issue and for posting your work around.

It looks like when we released imgix-url-params 11.14.1 the gif-q param mistakenly did not include the short_description property. We failed to catch this at the time because the imgix/gatsby renovate is not currently configured to automatically bump the imgix-url-params versions. This would have failed in CI, surfacing the issue sooner.

We're taking steps to fix the issue and ensure it doesn't happen again.

I'll update this ticket once this has been resolved.

luqven commented 1 year ago

Hey @hazzyeer, closing this issue as we just deployed a fix. Please let me know if you encounter further issues, and I'll be happy to re-open this.

Thank you again for reporting this issue!