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

ERR_INTERNAL_ASSERTION / hop sdk fetchConfigFromS3 error: Error: fetchJsonOrThrow #538

Closed
mindrunner opened this issue Dec 8, 2023 · 7 comments

Comments

@mindrunner
Copy link

I see our backend process crashing wiht the following error message. This does not happen when hop integration is disabled.

I suspect a bug in hop SDK. Happy to assist figuring out what's going on.

Could not reproduce locally, only happens in high-load situations.

hop sdk fetchConfigFromS3 error: Error: fetchJsonOrThrow error: The user aborted a request.                                                               
    at fetchJsonOrThrow (/usr/src/app/node_modules/.pnpm/@hop-protocol+sdk@0.0.1-beta.573/node_modules/@hop-protocol/sdk/dist/src/utils/fetchJsonOrThrow.j
    at processTicksAndRejections (node:internal/process/task_queues:95:5)                                                                                 
    at runNextTicks (node:internal/process/task_queues:64:3)                                                                                              
    at listOnTimeout (node:internal/timers:540:9)                                                                                                         
    at process.processTimers (node:internal/timers:514:7)                                                                                                 
    at async HopBridge.fetchIpfsCoreConfigData (/usr/src/app/node_modules/.pnpm/@hop-protocol+sdk@0.0.1-beta.573/node_modules/@hop-protocol/sdk/dist/src/B
    at async HopBridge.fetchCoreConfigDataWithIpfsFallback (/usr/src/app/node_modules/.pnpm/@hop-protocol+sdk@0.0.1-beta.573/node_modules/@hop-protocol/sd
    at async HopBridge.fetchConfigFromS3 (/usr/src/app/node_modules/.pnpm/@hop-protocol+sdk@0.0.1-beta.573/node_modules/@hop-protocol/sdk/dist/src/Base.js
    at async HopBridge.getFeeBps (/usr/src/app/node_modules/.pnpm/@hop-protocol+sdk@0.0.1-beta.573/node_modules/@hop-protocol/sdk/dist/src/Base.js:582:9) 
    at async Promise.all (index 2)                                                                                                                        
    at async HopBridge.getSendData (/usr/src/app/node_modules/.pnpm/@hop-protocol+sdk@0.0.1-beta.573/node_modules/@hop-protocol/sdk/dist/src/HopBridge.js:
    at async exports.getTransferQuote.promise (/usr/src/app/services/tools/bridges/hop/hop.js:211:22)                                                     
Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.                                        
Please open an issue with this stack trace at https://github.com/nodejs/node/issues                                                                       
                                                                                                                                                          
    at assert (node:internal/assert:14:11)                                                                                                                
    at internalConnectMultiple (node:net:1118:3)                                                                                                          
    at Timeout.internalConnectMultipleTimeout (node:net:1687:3)                                                                                           
    at listOnTimeout (node:internal/timers:575:11)                                                                                                        
    at process.processTimers (node:internal/timers:514:7) {                                                                                               
  code: 'ERR_INTERNAL_ASSERTION'                                                                                                                          
} 
@miguelmota
Copy link
Member

Hey @mindrunner what node version are you using?

You can try running node with this option as suggested in this node issue:

NODE_OPTIONS="--no-network-family-autoselection"

or try upgrading to the latest version of node 20.10.0 to see if that helps.

Seems like network_family_autoselection was made to be true by default in node v20 and causes the ERR_INTERNAL_ASSERTION issue with node for a lot of people.

The internal error seems to be thrown by the native node fetch function so it's been hard to debug the root cause.

@mindrunner
Copy link
Author

I suspected a Node 20 issue as well, since we just recently made the upgrade. Will test the suggested fixes next week and report back!

Thanks @miguelmota!!

@mindrunner
Copy link
Author

Btw, not directly related, but it would be nice to let the user chose the web requests library, similar to here: paraswap/paraswap-sdk#161

I prefer to not use fetch for multiple reasons and would like to use our own http client implementation.

@miguelmota
Copy link
Member

@mindrunner good suggestion! Definitely doable

@mindrunner
Copy link
Author

Cool, looking forward to that! :)

Btw, we are on node 20.10.0 already and facing the above mentioned issue.

@miguelmota
Copy link
Member

@mindrunner thanks for reporting back on the node version. Curious, did the node option flag work?

@mindrunner
Copy link
Author

Not under heavy load currently, but also did not see one crash so far. I consider it solved for now :) Thanks for helping

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