Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection refused after new version released #810

Open
pablogdnd opened this issue Oct 4, 2023 · 2 comments
Open

Connection refused after new version released #810

pablogdnd opened this issue Oct 4, 2023 · 2 comments

Comments

@pablogdnd
Copy link

Hi there!
After you released the latest version (with node v18 changes), both the pipeline and our local code, started to fail with many
System.Net.Sockets.SocketException : Connection refused

SLS version
Framework Core: 3.35.2 (local) 3.35.2 (global)
Plugin: 7.0.5
SDK: 4.4.0

Node v18.18.0
npm 9.8.1

serverless-s3-local 0.8.1
serverless-offline 8.8.1

i can also see your package references serverless-offline v13, which also removed old node versions

I tried updating everything but im still getting those connection refused...
Tks

@pablogdnd
Copy link
Author

I found the problem, node v18 uses curl rather than node-fetch, and our local s3 setup was using the IP and not localhost.
If you execute curl localhost:8001 -v, works fine, but failed with curl 127.0.0.1:8001

@ar90n
Copy link
Owner

ar90n commented Oct 5, 2023

Hi @pablogdnd !
Thanks for your report and workaround.
The priority of the name resolution method causes this problem.
Node v18 tries to translate the hostname into the ipv6 address at first.
So 'localhost' is translated into "::1" in your situation.

I think your workaround is good and enough to work.
In my opinion, using -dns-result-order=ipv4first as an argument of the node as follows may help you.

$ node -e "const dns = require('dns'); dns.lookup('localhost', (err, addresses) => {console.log(addresses)});"
::1
$ node --dns-result-order=ipv4first -e "const dns = require('dns'); dns.lookup('localhost', (err, addresses) => {console.log(addresses)});"
127.0.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants