@graphcommerce/graphql-mesh 10.1.0-canary.32 → 10.1.0-canary.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.1.0-canary.34
4
+
5
+ ## 10.1.0-canary.33
6
+
7
+ ### Patch Changes
8
+
9
+ - [#2648](https://github.com/graphcommerce-org/graphcommerce/pull/2648) [`24541b8`](https://github.com/graphcommerce-org/graphcommerce/commit/24541b8d3d7f5de80ebc7b9a03d439b4347eb9e6) - Fix multipart file uploads through the mesh returning "Unable to parse the request." in `next dev` (turbopack). `customFetch` used `globalThis.fetch` (undici) inside Next, while `@graphql-tools/executor-http` builds upload bodies with `FormData` from `@whatwg-node/fetch`. In `next dev`, `@whatwg-node/fetch` is evaluated while `next.config.ts` loads — before any `__NEXT` global exists — so its Next.js detection fails and it exports its ponyfills. Undici doesn't recognize the ponyfill `FormData` and stringified the request body to the literal `[object Object]`. `customFetch` now always uses the fetch exported by `@whatwg-node/fetch`, which is `globalThis.fetch` whenever the native path is active and the matching ponyfill fetch otherwise, so fetch and `FormData` always come from the same implementation family. ([@paales](https://github.com/paales))
10
+
3
11
  ## 10.1.0-canary.32
4
12
 
5
13
  ### Patch Changes
package/customFetch.ts CHANGED
@@ -2,8 +2,19 @@ import fetchRetry from 'fetch-retry'
2
2
  import type { RequestInitWithRetry } from 'fetch-retry'
3
3
 
4
4
  const fetcher = fetchRetry(
5
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, no-underscore-dangle, @typescript-eslint/no-var-requires
6
- process.env.__NEXT_PROCESSED_ENV ? globalThis.fetch : require('@whatwg-node/fetch').fetch,
5
+ /**
6
+ * Always use the fetch that `@whatwg-node/fetch` exports, never `globalThis.fetch` directly. When
7
+ * `@whatwg-node/fetch` detects a Next.js runtime it re-exports the native fetch primitives (so
8
+ * inside Next this IS `globalThis.fetch`/undici, keeping SSL handshakes alive), but when that
9
+ * detection fails — `next dev` (turbopack) evaluates it while loading `next.config.ts` (via
10
+ * `@graphql-codegen/cli`), before any `__NEXT` global exists — it exports its ponyfills instead.
11
+ * In that case `@graphql-tools/executor-http` builds multipart upload bodies with the ponyfill
12
+ * `FormData`, which undici doesn't recognize and stringifies to the literal `[object Object]`
13
+ * (Magento: "Unable to parse the request."). The fetch implementation must therefore always come
14
+ * from the same family as the `FormData`/`File` classes executor-http uses.
15
+ */
16
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-var-requires
17
+ require('@whatwg-node/fetch').fetch,
7
18
  )
8
19
 
9
20
  /**
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/graphql-mesh",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "10.1.0-canary.32",
5
+ "version": "10.1.0-canary.34",
6
6
  "dependencies": {
7
7
  "@whatwg-node/fetch": "^0.10.13",
8
8
  "fetch-retry": "^5.0.6",
@@ -20,9 +20,9 @@
20
20
  },
21
21
  "peerDependencies": {
22
22
  "@apollo/client": "*",
23
- "@graphcommerce/eslint-config-pwa": "^10.1.0-canary.32",
24
- "@graphcommerce/prettier-config-pwa": "^10.1.0-canary.32",
25
- "@graphcommerce/typescript-config-pwa": "^10.1.0-canary.32",
23
+ "@graphcommerce/eslint-config-pwa": "^10.1.0-canary.34",
24
+ "@graphcommerce/prettier-config-pwa": "^10.1.0-canary.34",
25
+ "@graphcommerce/typescript-config-pwa": "^10.1.0-canary.34",
26
26
  "@graphql-mesh/runtime": "*",
27
27
  "@graphql-mesh/types": "*"
28
28
  },