Comments (15)
Hey there @WimSuenensDIRACIndustries,
It's kinda hard to diagnose the problem without seeing your code. Can you post the following:
- Your Restlet
- The Node.JS code you are using
- I see you are using nodemon. What configuration do you have it running under?
- What version of NSRestlet are you using?
- Which version of Netsuite are you using (they are pushing an update which changes restlets a bit currently and it might be related)
I know some parts of the code may be private, so just post the parts you think might be relevant.
Thanks.
from nsrestlet.
Hi Michael,
I can share you these files.
I'm using an node-express server which communicates with NetSuite through your package. This server is providing API's to my frontend which is running Angular. My restlet is just returning json. All my calls are working properly, however from time to time the server crashes with this feedback. 'actual_error' is undefined.
So, there is some issue in the callbacks.
I'm not sure, but it could be an error which occurs when NetSuite is down or unable to reach.
Regards,
Wim
netsuiteRP.js.pdf
requestRP.js.pdf
from nsrestlet.
Hey Wim, thanks, I'll take a look at those. Also, can you tell me the following:
Are you just using default nodemon from the command line (no arguments added)?
Which version of nsrestlet do you have? (Trying to see if it's an earlier version)
Which version is your Netsuite? (Like 2019.1, 2019.2, etc)
from nsrestlet.
Also, as a temporary fix, try the following:
- Go to nsrestlet inside of your node_modules. Find the nsrestlet.js file.
- Change line 531 to the following:
var error_message = error.message || JSON.stringify(error);
Let me know if that works for you.
I'm going to be heading to work soon, so it may be a while before my next response. I'll try to get back to you as soon as I can. Hope your having a good morning
-Michael
from nsrestlet.
I'm using default nodemon, indeed.
nsrestlet version 2.0.1 and NetSuite 2019.2.
from nsrestlet.
Thanks. Did the fix I posted above work?
from nsrestlet.
I've updated as requested and will test it like this in the next days.
As said, they issue occurs for an unknown reason, so I will see in the coming days if it works out correctly. Thanks for the feedback!
from nsrestlet.
Thanks! And yeah, please let me know.
Also, just a note, that code would have only been thrown if Netsuite threw an error. So just make sure your Error catching is smooth and you should be good.
I'll also try and push an updated version of the module with this fix sometime soon.
from nsrestlet.
Hello Michael,
FYI: all is working properly. The errors which causes the module to crash were 'ENOTFOUND' and 'ENETDOWN'. I can handle this in my code now.
Thanks.
Kind regards,
Wim
from nsrestlet.
Hey Wim,
Thanks for the update. I'll close this for now, but if it happens again, please leave another comment and I'll re-open it right up.
Hope you have an awesome Friday!
from nsrestlet.
Hi,
Same thing happening to me. It only happens once every hundreds of calls, so I'm pretty sure it's a real exception on connection or NetSuite response. Very hard to replicate.
TypeError: Cannot read property 'error' of undefined
at Request._callback (/home/node/io_hubspot/node_modules/nsrestlet/nsrestlet.js:546:28)
at Request.self.callback (/home/node/io_hubspot/node_modules/request/request.js:185:22)
at Request.emit (events.js:321:20)
at Request.<anonymous> (/home/node/io_hubspot/node_modules/request/request.js:1161:10)
at Request.emit (events.js:321:20)
at IncomingMessage.<anonymous> (/home/node/io_hubspot/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:427:28)
at IncomingMessage.emit (events.js:333:22)
at endReadableNT (_stream_readable.js:1201:12)
As it's not returning an error for line # 529 an body is undefined on line 538.
I'm not sure if we have other situations where body is allowed to be undefined, could we:
if (error || body === undefined) {
callback(undefined, undefined, undefined); // can even add an error in here
}
Otherwise perhaps add this check after line # 539
if (actual_body === undefined) {
callback(undefined, undefined, undefined);
}
Otherwise:
line # 546
if (actual_body !== undefined && actual_body !== null && actual_body.hasOwnProperty('error') actual_body.error && actual_body.error.code)
But looks overkill...
I haven't checked much into the rest of the code, so I'm not sure which style would suite you best or if any of this fixes looks good to you. I can do a PR with any if you prefer.
from nsrestlet.
Hey @mritzco thanks for catching that error. I'll try and push a corrected version up in the next two weeks that (hopefully) catches that.
Sorry about the late response, and hope your week is going well :)
from nsrestlet.
Hey @MichaelEPope, Can you please upgrade your package after resolving all of the above issues. Thanks and regards.
from nsrestlet.
I am also sporadically hitting this error. Any updates on this?
from nsrestlet.
I hit the same issue sometimes. @MichaelEPope
How about this simple/efficient fix line 546?
if (actual_body?.error && actual_body.error?.code)
from nsrestlet.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nsrestlet.