You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 16, 2023. It is now read-only.
This was not the only change I needed though. After commenting out that line, my tests were still timing out. I saw that Stripe is waiting for the 'socket' event to emit. Then waiting for that socket to emit a 'connect' event. I emitted those events from the request proxy and everything now works as expected.
// Route HTTP requests to our little helper.HTTP.request=function(options,callback){if(typeofoptions==='string'||optionsinstanceofString)options=URL.parse(options);// WebSocket request: pass through to Node.js libraryif(options.headers&&options.headers.Upgrade==='websocket')returnnewHTTP.ClientRequest(options,callback);consthostname=options.hostname||options.host&&options.host.split(':')[0]||'localhost';if(Replay.isLocalhost(hostname)||Replay.isPassThrough(hostname))returnnewHTTP.ClientRequest(options,callback);// Proxy requestconstrequest=newProxyRequest(options,Replay.chain.start);if(callback)request.once('response',callback);// -----------------------------------------------------------------------------// I added this setTimeoutsetTimeout(function(){request.emit('socket',request);request.emit('secureConnect');},100);// -----------------------------------------------------------------------------returnrequest;};
I'm not sure how to proceed here. I'm not very familiar with this library so I don't know if this is expected or a bug or just not implemented yet. I'm happy to make a PR if you can provide some guidance on how to properly get this working.
I'm trying to use node-relay to stub out
stripe-nodelibrary. At first, simply adding this library was causing all my stripe requests to immediately timeout. I did some digging and found that when callingsetTimeouton theProxyRequestit's calling the timeout callback immediately: https://github.com/assaf/node-replay/blob/master/src/proxy.js#L81 I simply commented this out. You can see the Stripe API callsetTimeoutcausing this to fire: https://github.com/stripe/stripe-node/blob/master/lib/StripeResource.js#L297This was not the only change I needed though. After commenting out that line, my tests were still timing out. I saw that Stripe is waiting for the
'socket'event to emit. Then waiting for that socket to emit a'connect'event. I emitted those events from therequestproxy and everything now works as expected.I'm not sure how to proceed here. I'm not very familiar with this library so I don't know if this is expected or a bug or just not implemented yet. I'm happy to make a PR if you can provide some guidance on how to properly get this working.