ardatan / graphql-mesh

πŸ•ΈοΈ GraphQL Federation Framework for any API services such as REST, OpenAPI, Swagger, SOAP, gRPC and more...
https://the-guild.dev/graphql/mesh
MIT License
3.26k stars 332 forks source link

Mesh TypeError: this.splice is not a function after updating to latest #3900

Closed belgattitude closed 2 years ago

belgattitude commented 2 years ago

Issue workflow progress

Describe the bug

Upgrading to latest versions of graphql-mesh packages leads to an error related to the cache-inmemory-lru. Seems a regression as it was passing on a previous iteration. I tested this on two repos.

image

Links: playwright on github action | github P/R. | .meshrc.yaml

[WebServer] πŸ’₯ πŸ•ΈοΈ  Mesh TypeError: this.splice is not a function
    at HeadersList.append (/home/runner/work/nextjs-monorepo-example/nextjs-monorepo-example/node_modules/@graphql-mesh/cache-inmemory-lru/node_modules/cross-undici-fetch/dist/patch-headers-list.js:44:16)
    at fetching (/home/runner/work/nextjs-monorepo-example/nextjs-monorepo-example/node_modules/undici/lib/fetch/index.js:461:25)
    at Agent.fetch (/home/runner/work/nextjs-monorepo-example/nextjs-monorepo-example/node_modules/undici/lib/fetch/index.js:218:16)
    at Object.fetch (/home/runner/work/nextjs-monorepo-example/nextjs-monorepo-example/node_modules/undici/index.js:102:22)
    at fetch (/home/runner/work/nextjs-monorepo-example/nextjs-monorepo-example/node_modules/cross-undici-fetch/dist/create-node-ponyfill.js:114:23)
    at file:///home/runner/work/nextjs-monorepo-example/nextjs-monorepo-example/node_modules/fetchache/index.mjs:15:36
    at async field.resolve (file:///home/runner/work/nextjs-monorepo-example/nextjs-monorepo-example/node_modules/@omnigraph/json-schema/index.mjs:470:34)
    at async Promise.all (index 0)
    at async file:///home/runner/work/nextjs-monorepo-example/nextjs-monorepo-example/node_modules/@envelop/core/index.mjs:671:27
    at async processRequest (file:///home/runner/work/nextjs-monorepo-example/nextjs-monorepo-example/node_modules/@graphql-yoga/common/index.mjs:413:28)

To Reproduce

I can provide a reprod in the coming days. Otherwise cloning this P/R might help: https://github.com/belgattitude/nextjs-monorepo-example/pull/1800

Workaround

Simply remove the cache config from yarnrc.yml


#cache:
#  inmemoryLRU:
#   max: 10
sources:
  - name: CatFacts
    handler:
      newOpenapi:
        baseUrl: https://catfact.ninja
        oasFilePath: https://catfact.ninja/docs/api-docs.json

Environment:

paales commented 2 years ago

This is fixed in the latest version I believe :)

belgattitude commented 2 years ago

@paales not yet.

Source of the bug was in cross-undici-fetch@0.3.1 on which @graphql-mesh/utils depends.

The graphql-mesh@^0.35 upgraded cross-undici-fetch to 0.4.3. That would fix it

Unfortunately @graphql-mesh/cache-inmemory-lru still depends on an older version of @graphl-mesh/utils.

I saw that you reworked the publishing in the upcoming release https://github.com/Urigo/graphql-mesh/pull/3981. Not sure if it will fix the issue. I tried to locate the @graphql-mesh/cache-inmemory-lru in the monorepo but I could not find it, otherwise I'd be happy to provide a P/R.

Thanks for your work

PS/

Output from yarn why cross-undici-fetch

β”œβ”€ @graphql-mesh/utils@npm:0.34.4
β”‚  └─ cross-undici-fetch@npm:0.3.1 (via npm:0.3.1)
β”‚
β”œβ”€ @graphql-mesh/utils@npm:0.35.0
β”‚  └─ cross-undici-fetch@npm:0.4.3 (via npm:^0.4.0)

Output from yarn why @graphql-mesh/cache-inmemory-lru

β”œβ”€ @your-org/api-gateway@workspace:packages/api-gateway [f054d]
β”‚  └─ @graphql-mesh/cache-inmemory-lru@npm:0.6.18 [4d233] (via npm:0.6.18 [4d233])

Output from yarn why @graphql-mesh/utils

β”œβ”€ @graphql-mesh/cache-inmemory-lru@npm:0.6.18
β”‚  └─ @graphql-mesh/utils@npm:0.34.4 (via npm:0.34.4)
β”‚
β”œβ”€ @graphql-mesh/cache-localforage@npm:0.6.6
β”‚  └─ @graphql-mesh/utils@npm:0.35.0 (via npm:0.35.0)
β”‚
β”œβ”€ @graphql-mesh/cli@npm:0.71.0
β”‚  └─ @graphql-mesh/utils@npm:0.35.0 (via npm:0.35.0)
β”‚
β”œβ”€ @graphql-mesh/config@npm:0.37.0
β”‚  └─ @graphql-mesh/utils@npm:0.35.0 (via npm:0.35.0)
β”‚
β”œβ”€ @graphql-mesh/graphql@npm:0.26.0
β”‚  └─ @graphql-mesh/utils@npm:0.35.0 (via npm:0.35.0)
β”‚
β”œβ”€ @graphql-mesh/merger-bare@npm:0.13.48
β”‚  └─ @graphql-mesh/utils@npm:0.35.0 (via npm:0.35.0)
β”‚
β”œβ”€ @graphql-mesh/merger-stitching@npm:0.15.50
β”‚  └─ @graphql-mesh/utils@npm:0.35.0 (via npm:0.35.0)
β”‚
β”œβ”€ @graphql-mesh/new-openapi@npm:0.4.21
β”‚  └─ @graphql-mesh/utils@npm:0.35.0 (via npm:0.35.0)
β”‚
β”œβ”€ @graphql-mesh/runtime@npm:0.35.0
β”‚  └─ @graphql-mesh/utils@npm:0.35.0 (via npm:0.35.0)
β”‚
β”œβ”€ @graphql-mesh/store@npm:0.8.9
β”‚  └─ @graphql-mesh/utils@npm:0.35.0 (via npm:0.35.0)
β”‚
...
ardatan commented 2 years ago

We don't use @graphql-mesh/cache-inmemory-lru package anymore. It should no longer exist in your lock file.