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

On integrating with server side is causing crashing node application #35

Open
pgaurav9 opened this issue Feb 27, 2022 · 7 comments
Open

Comments

@pgaurav9
Copy link

While integrating the vwo-node-sdk library on the server-side of an existing SSR react application is crashing the whole application. Following is the exception that I am receiving:
`events.js:377
throw er; // Unhandled 'error' event
^

Error: read ECONNRESET
at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20)
Emitted 'error' event on ClientRequest instance at:
at TLSSocket.socketErrorListener (_http_client.js:475:9)
at TLSSocket.emit (events.js:400:28)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
errno: -54,
code: 'ECONNRESET',
syscall: 'read'
}
error Command failed with exit code 1.`

However, the documentation provided here, mentioned about following best practices, which itself is a generic statement. Kindly help here. Thanks!
Please follow the best practices to ensure that your app is prevented from crashing.

@softvar
Copy link
Member

softvar commented Feb 28, 2022

Hey @pgaurav9 ,

Could you please let us know the following so that we can debug this:

  1. Node version being used
  2. NPM/yarn version being used
  3. VWO SDK version
  4. Is it an Express-based framework or any other?
  5. When does the error appear? Is it when the app is launched or when any API is invoked?

Thanks

@pgaurav9
Copy link
Author

pgaurav9 commented Mar 1, 2022

Hi @softvar ,

I am using the following:

  1. Node version: 14.18.1
  2. Yarn version: 1.22.17
  3. VWO SDK version: 1.32.3
  4. Yes we are using Express(version 4.17.1)
  5. Error appears after any of the API invoked using VWO client. Example when the application requests settingsFile(using settingsFile method) or activate(using activate method), immediately after executing everything it gets crashed all of sudden. I tried to put logs, and I am getting responses from the above-mentioned functions. But somehow it keeps crashing.

Let me know if further information is required. Thanks!

@softvar
Copy link
Member

softvar commented Mar 15, 2022

Hi @pgaurav9 ,

After debugging, it seems to be an issue with Node 14.x and 16.x versions. This is something related to how async-await works internally. Our SDK does not use sockets, instead only https module for sending any async network call.

Please try without async-await syntax and let us know if it's resolved for you.

In the meantime, we are still figuring out what is causing this issue in different latest node.js versions.

@nickdandakis
Copy link

hey @softvar, we've been seeing this in our application and I attempted to get a minimal repro setup for y'all to debug here:
https://github.com/nickdandakis/vwo-node-nextjs-ssr

of course, as these things go, this minimal repro doesn't actually produce the ECONNRESET issue reliably. we've also found that the local server doesn't actually crash (maybe nextjs is handling this gracefully), and the deployed environment (on Render or AWS) doesn't actually produce this ECONNRESET

I tried using node v14, v16 (what we use), and v18 (app doesn't even run on v18 yet), and no luck in getting a consistent repro.

I'll keep the repo up in case it's helpful for anyone else trying to get the VWO node SDK to work against SSR Nextjs, which I imagine is becoming more and more popular.

@iamstarkov
Copy link

we have the same issue

@iamstarkov
Copy link

iamstarkov commented Dec 7, 2022

Node version: 18.12.0
Yarn version: 1.22.17
VWO-node-SDK version: 1.41.0
Yes we are using Express(version 4.17.1)
Errors roll once we run vwo.launch

@lytvynenko
Copy link

lytvynenko commented Dec 28, 2022

this PR fixes (kinda) the issue - #44. At least it doesn't crash the server anymore.

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

5 participants