hello :slightly_smiling_face: I've updated my appl...
# pact-js
m
hello ๐Ÿ™‚ I've updated my application to use node20 (was using before node18), and started received errors "socket hang up" while running the tests. has anyone seen this? The tests already fail with the image below, but then in the logs it shows the
socket hang up
part
m
Check issues on GitHub. I think it's something about ipv4/IPv6 defaults
m
i tried looking there btw, but maybe with the wrong query. thanks, will look with ip* in there
m
This is the issue I was thinking of, let me know if it's helpful: https://github.com/pact-foundation/pact-js/issues/1066
m
yep, thanks! could find that one, but i already have 127.0.0.1 and the axios configuration and this is still happening
m
m
so i did this directly in the test file now:
Copy code
beforeAll(() => {
  globalAxios.defaults.httpAgent = new http.Agent({
    keepAlive: false,
  });
});

afterAll(() => (globalAxios.defaults.httpAgent = axiosDefaultsHttpAgent));
it worked like this. think i might have other configurations somewhere that were rewriting the httpAgent that i changed before
๐Ÿ‘ 1
m
Iโ€™d be interested to know if you could hack the proxy code in your test, to see if that fixes it
m
hm..what do you mean?
m
I think it could be fixable by adding the following to the proxy Pact JS spins up.
Copy code
res.append('Connection', 'close');
Iโ€™m just seeing if I can locate a suitable spot to try it. This could circumvent the need for you to add the axios config
m
ah yes, i would prefer that
m
m
thought it would be some change on my code ๐Ÿ˜› so to try that i need to make a fork of the repo and install locally righT?
but if im understanding this correctly, the connection is being kept alive as default on the client side and this mockServer is closing it without sending the notification
m
I believe so
Iโ€™m just suggesting hacking the
node_modules
directly for now
m
ok, so this instruction you sent above would do that part
m
and if you can fix it there, then a proper PR (or update on the above issue) would be the next step
yep
m
hm ok, i was trying that now,but it doesnt seem to be working
editing the node_modules file directly works for you?
m
as in, it fixes the issue? Or it has an impact?
m
well both ๐Ÿ˜› im not seeing any change
was trying to make a console log also and there was nothing
m
haha ummm well it should. I guess it depends on where youโ€™re logging etc. Try `console.log`ing somewhere higher up the chain
m
im trying just in the hook you mentioned
before app.use
๐Ÿ‘ 1