I am using Edgio 7.11.4, SvelteKit 1.0.0, Node.js adaptor, and Node.js connector. Everything on the website runs smoothly except when making requests to another API server, where it often encounters the error “Connect ECONNREFUSED” Although the API server is hosted on a different service, some process attempts to call localhost instead of the API server URL. You can check the attached image for more details.

Error information:

FetchError: request to https://.net/api/webpages/1/1/content-webpage?slug=/resources&pageStatus=Published&isBrowser=false failed, reason: connect ECONNREFUSED
at EdgioClientRequest. (file:///mnt/f/
at EdgioClientRequest.emit (node:events:530:35)
at TLSSocket.socketErrorListener (node:_http_client:495:9)
at TLSSocket.emit (node:events:518:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
type: ‘system’,
erroredSysCall: ‘connect’

I would appreciate any help. Thank you very much.

@tuanrealx ,

Would you be able to show how the code is making this API request? I am assuming that https://.net/api/webpages/1/1/content-webpage?slug=/resources&pageStatus=Published&isBrowser=false has the hostname removed by you and not actually a malformed URL.

Hi @tristan.lee,
I hid the URL because it is sensitive info. I access the URL in log error and the data shows up for the URL. So it may not be the cause of making errors.

The code is working on the dev machine. The error only occurs when deployed to the Edgio. I think maybe our source uses an old version package so there are some bugs in it.
In the error description, our source uses Sveltekit 1.0.0 so we could not use the latest Node.js adaptor
I appreciate you trying to figure out my error. Thank you so much.
We decided to change the way we deploy code. and will take a deep look when we have time.

No problem. I was more looking to see how the URL request is made in the code (not the full URL itself). Perhaps there is something misconfigured with fetch or however it is this request is being made.

Feel free to reach out if you need additional help.