Closed eavendano closed 2 years ago
I ran into a similar issue, this appears to be tied to the cross-undici-fetch package, but instead with graphql-tools.
@saihaj over at https://github.com/dotansimha/graphql-code-generator/issues/8012#issuecomment-1172754938 identified the dependency causing the problem.
You can modify your package.json to get around the issue, for yarn you can add the following: Copied from @tylermenezes here https://github.com/dotansimha/graphql-code-generator/issues/8012#issuecomment-1172725253
"resolutions": {
"undici": "5.5.1"
}
For npm (requires npm 8.3 or higher) you can do the following, this is how I fixed it for the time being.
{
...
"dependencies": ...
"devDependencies": ...
"overrides": {
"undici": "5.5.1"
}
}
Hopefully this helps you out as a workaround until undici is fixed.
Awesome! It worked for me.
@eavendano I don't know that I would have closed this as the problem still exists and all my workaround does is downgrades the version for now. This will still affect everyone using this until they fix the dependency in this package or the upstream undici fixes it's issue.
The issue is with cross-undici-fetch
's usage of undici
.
import { fetch } from 'cross-undici-fetch';
const res = await fetch('https://jsonplaceholder.typicode.com/posts', {
method: 'POST',
body: JSON.stringify({
title: 'foo',
body: 'bar',
userId: 1,
}),
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
});
console.log(await res.text());
This fails with the error from OP. Replace import { fetch } from 'cross-undici-fetch';
with import { fetch } from 'undici';
and it works fine.
Thanks for the issue! We're on it right now!
Great news! Thanks a log @ardatan! Amazing job my friend.
Opened #53 unpinning again, btw
GET without body
Hello @ardatan! I'm checking the new version
0.4.8
on a Node server. When I did the update from0.4.7
to0.4.8
I got a new issue. I got the following code:But now when I run the server I have the message showing in my log:
On my code I have not changed a single line of code and I just get that error. Here is the stack trace:
Is this a bug or is there something I need to do after the upgrade?