Anyone having issues with undici at build time?
Unanswered
Giant panda posted this in #help-forum
Giant pandaOP
I'm gettint this error and I'm not able to deploy:
#0 16.74 Failed to compile.
#0 16.74
#0 16.74 ./node_modules/undici/lib/web/fetch/util.js
#0 16.74 Module parse failed: Unexpected token (884:57)
#0 16.74 File was processed with these loaders:
#0 16.74 * ./node_modules/next/dist/build/webpack/loaders/next-flight-loader/index.js
#0 16.74 * ./node_modules/next/dist/build/webpack/loaders/next-swc-loader.js
#0 16.74 You may need an additional loader to handle the result of these loaders.
#0 16.74 | // 5. If object is not a default iterator object for interface,
#0 16.74 | // then throw a TypeError.
#0 16.74 > if (typeof this !== 'object' this === null !(#target in this)) {
#0 16.74 | throw new TypeError(
#0 16.74 |
#0 16.74
#0 16.74 Import trace for requested module:
#0 16.74 ./node_modules/undici/lib/web/fetch/util.js
#0 16.74 ./node_modules/undici/lib/web/fetch/response.js
#0 16.74 ./node_modules/undici/index.js
#0 16.74 ./node_modules/@elastic/transport/lib/connection/UndiciConnection.js
#0 16.74 ./node_modules/@elastic/transport/lib/connection/index.js
#0 16.74 ./node_modules/@elastic/transport/index.js
#0 16.74 ./node_modules/@elastic/elasticsearch/index.js
#0 16.74 ./src/app/api/elastic/route.ts
#0 16.74 Failed to compile.
#0 16.74
#0 16.74 ./node_modules/undici/lib/web/fetch/util.js
#0 16.74 Module parse failed: Unexpected token (884:57)
#0 16.74 File was processed with these loaders:
#0 16.74 * ./node_modules/next/dist/build/webpack/loaders/next-flight-loader/index.js
#0 16.74 * ./node_modules/next/dist/build/webpack/loaders/next-swc-loader.js
#0 16.74 You may need an additional loader to handle the result of these loaders.
#0 16.74 | // 5. If object is not a default iterator object for interface,
#0 16.74 | // then throw a TypeError.
#0 16.74 > if (typeof this !== 'object' this === null !(#target in this)) {
#0 16.74 | throw new TypeError(
#0 16.74 |
'next' called on an object that does not implement interface ${name} Iterator.#0 16.74
#0 16.74 Import trace for requested module:
#0 16.74 ./node_modules/undici/lib/web/fetch/util.js
#0 16.74 ./node_modules/undici/lib/web/fetch/response.js
#0 16.74 ./node_modules/undici/index.js
#0 16.74 ./node_modules/@elastic/transport/lib/connection/UndiciConnection.js
#0 16.74 ./node_modules/@elastic/transport/lib/connection/index.js
#0 16.74 ./node_modules/@elastic/transport/index.js
#0 16.74 ./node_modules/@elastic/elasticsearch/index.js
#0 16.74 ./src/app/api/elastic/route.ts
18 Replies
Giant pandaOP
No
I'm deploying to GCP
I've already upgraded to the latest version of next, latest version of undici and latest version of elasticsearch
but still having the same issue.
Giant pandaOP
hello any updates on this topic?
@Giant panda
Is there any chance you are fetching your own api
Undici is nothing but what nextjs uses under the hood for fetch
Giant pandaOP
I don't think so. I'm using the native fetch for fetching data from my ApolloServer. According to the logs I'm seeing it's the @elastic/transport library the one that's importing the undici library. And with the tests I've made uninstalling the @elastic/search library from the project the build is performed correctly
the thing is that elastic is a crucial part of my application.
@Arinji Undici is nothing but what nextjs uses under the hood for fetch
Giant pandaOP
according to the error I'm seeing and the folk's comments at github issues is a SyntaxError in this line
if (typeof this !== 'object' || this === null || !(#target in this)) { NextJs not being able to parse the #target in this bit.sorry no clue then, when i get undici errors its mostly me fetching my own api
Giant pandaOP
can you explain what you mean fetching your own api, please?
This is the message. Maybe something in the /api/elastic/route.ts ?