Skip to main content

Questions tagged [undici]

use this tag for undici nodejs http client library.

0 votes
0 answers
22 views

vercel deploy success but access web error Nextjs 14 undici wrong verssion

Deploy success but access web Application error: a server-side exception has occurred enviroments NEXT_PUBLIC in vercel, node 20.x un build success on local and vercel. But on vercel access page after ...
HKN's user avatar
  • 11
0 votes
2 answers
2k views

Error while running Next.js project: "TypeError: fetch failed" and "unable to verify the first certificate"

I encountered an error while trying to run my Next.js project using npm run dev. The error message is as follows: TypeError: fetch failed at node:internal/deps/undici/undici:12618:11 at ...
Vimal Mudalagi's user avatar
0 votes
0 answers
392 views

DiscordJs ConnectionTimeoutError UND_ERR_CONNECT_TIMEOUT

So I have a discord bot on discordJs 14.9.0. When I run it on my PC, it runs fine. But as soon as I try to start it on my server, it gets this error: ConnectTimeoutError: Connect Timeout Error ...
Adman's user avatar
  • 1
0 votes
2 answers
1k views

TypeError: Headers.append: ":method" is an invalid header name - SvelteKit HTTPS Connection

I am trying to connect to a HTTPS express server set up like so: const https = require('https') const key = fs.readFileSync('./cert/key.pem') const cert = fs.readFileSync('./cert/cert.pem') const ...
Jack Goodman's user avatar
0 votes
0 answers
59 views

Getting error in `undici` module `Class extends value #<child> is not a constructor or null` on node upgrade to 18.18.2 and above

I'm encountering a TypeError when making requests for a token from the googleapis library using a JWT client. The error message is as follows: TypeError: Class extends value #<child> is not a ...
Deepak Terse's user avatar
1 vote
1 answer
2k views

Is it possible to set a global dispatcher for the built-in `fetch()` in Node?

You can pass a dispatcher to fetch() in Node: import { Agent } from 'undici'; const response = await fetch(url, { dispatcher: new Agent(/* ... */), }); And you can set a global dispatcher if you'...
steveluscher's user avatar
  • 4,209
4 votes
1 answer
7k views

TypeError: terminated [cause]: SocketError: other side closed in fetch Nodejs

I got this error when I keep fetching an external API, I am simply calling: await fetch(url, method: "POST", headers:headers, body: JSON.stringify(payload)) TypeError: terminated at ...
TungTung's user avatar
  • 291
0 votes
3 answers
2k views

Fetch request to PocketBase fails from terminal but works in Postman and the browser | Next.js13

I'm building a Next.js app using create-next-app@latest with PocketBase as the database. My Problem is that my local PocketBase instance refuses the connection from my NextJS app, but has no problem ...
Zaham2's user avatar
  • 347
0 votes
0 answers
92 views

Window Fetch Response can't be converted to JSON when URL object passed as parameter

According to the documentation of the Fetch method , it accepts a: resource This defines the resource that you wish to fetch. This can either be: A string or any other object with a stringifier — ...
George Katsanos's user avatar
0 votes
1 answer
2k views

undici node make api request with header for Authorization

im trying to make a api request with undici const apiRequest = await request("https://example.com") const apiJson = await apiRequest.body.json() const info = apiJson.data which works so far....
Codesk's user avatar
  • 25
1 vote
0 answers
1k views

How can I keep a HTTP connection alive if I am making the first request outside of the main fetch function in NodeJS?

I have the following fetch function which I use with the undici fetch library: async function call() { return await fetch('http://127.0.0.1:3000/', { dispatcher: new Agent({ ...
Optimus Servers's user avatar
2 votes
1 answer
1k views

Send a message in discord channel with POST request with undici

I'm trying to understand how the Discord API works, and I'm struggling to send a message in a channel. the code executes fine, but the message is not being sent. I tried with this code: await request(...
clapmemereview's user avatar
2 votes
1 answer
4k views

NodeJs fetch failed while using get/post request

I am building a rest API using undici. I am getting the following error: TypeError: fetch failed I have implemented the following code: const crypto = require('crypto'); const OAuth = require('oauth-...
Vatsal's user avatar
  • 23
3 votes
1 answer
2k views

Use proxy with Undici Fetch request in Node JS

Question I'm unsure about how to use a proxy with Undici fetch. I hope to use separate proxies for any fetch request with username and password authentication if applicable. I've found some ...
Slick's user avatar
  • 54
6 votes
4 answers
3k views

Accept self-signed certificates for undici fetch

How do I do fetch('https://localhost:8888') for a locally running HTTP server with a self-signed cert (fetch coming from undici)?
Vitali's user avatar
  • 3,645