Upload a file to Autodesk Forge - ESOCKETTIMEDOUT error - node.js

I am new to Autodesk-Forge API and I am trying to use the sample dmSample.js, included in the node.js SDK.
The example works well for very small files (up to 500 Kb)
However, when I try to upload larger files, (even just 1 Mb), the execution stops after few seconds with the following error message :
Error: { Error: ESOCKETTIMEDOUT
at ClientRequest.<anonymous> (C:\node.js dev\forge-api-nodejs-client node_mo dules\request\request.js:819:19)
at ClientRequest.g (events.js:292:16)
at emitNone (events.js:86:13)
at ClientRequest.emit (events.js:185:7)
at TLSSocket.emitTimeout (_http_client.js:629:10)
at TLSSocket.g (events.js:292:16)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:185:7)
at TLSSocket.Socket._onTimeout (net.js:338:8)
at ontimeout (timers.js:386:14) code: 'ESOCKETTIMEDOUT', connect: false
}
The file I am trying to upload is 30 Mb and is on my local post.
Any idea ?

I was able to fix it by increasing the value of the timeout of the request module.
Forge uses a wrapper that it is located in
/src/ApiClient.js
Search for this.timeout and set it to something like.
this.timeout = 600000;

Related

WARN: Write to InfluxDB failed [[RequestTimedOutError]]

WARN: Write to InfluxDB failed (attempt: 1). Error:
at S.<anonymous> (/Users/sathish/Documents/sample/raviAPI/node_modules/core-js/internals/wrap-error-constructor-with-cause.js:37:62)
at new super (/Users/sathish/Documents/sample/raviAPI/node_modules/core-js/modules/es.error.cause.js:28:43)
at new S (/Users/sathish/Documents/sample/raviAPI/node_modules/#influxdata/influxdb-client/src/errors.ts:163:5)
at ClientRequest.<anonymous> (/Users/sathish/Documents/sample/raviAPI/node_modules/#influxdata/influxdb-client/src/impl/node/NodeHttpTransport.ts:346:23)
at ClientRequest.emit (events.js:314:20)
at ClientRequest.EventEmitter.emit (domain.js:483:12)
at Socket.emitRequestTimeout (_http_client.js:715:9)
at Object.onceWrapper (events.js:420:28)
at Socket.emit (events.js:326:22)
at Socket.EventEmitter.emit (domain.js:483:12)
at Socket._onTimeout (net.js:483:8)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
name: 'RequestTimedOutError',
message: 'Request timed out'
I am facing this issue while writing data for each second in influxdb.
This is the influxdb client i am using from nodejs #influxdata/influxdb-client
It would be easier to answer this if you would post some of the code here.
looks like classing http request timeout
https://github.com/influxdata/influxdb-client-js/blob/558b3b4f6a5fd1e94c1579bd894cb0ce5e126368/packages/core/src/impl/node/NodeHttpTransport.ts#L345
which comes from regular nodejs http.IncomingMessage
https://github.com/influxdata/influxdb-client-js/blob/558b3b4f6a5fd1e94c1579bd894cb0ce5e126368/packages/core/src/impl/node/NodeHttpTransport.ts#L47
you can read more about timeouts here https://nodejs.org/api/http.html#event-timeout
Whatever timeout setting you are using is too low for the server to respond.
Default Agent has timeout options in milliseconds, probably there is a way to configure that in this node module as well.
https://nodejs.org/api/http.html#new-agentoptions
https://github.com/influxdata/influxdb-client-js/blob/558b3b4f6a5fd1e94c1579bd894cb0ce5e126368/packages/core/src/impl/node/NodeHttpTransport.ts#L62

onlyoffice nextcloud "document could not be saved" nodeJS - postData error

Using nextcloud 17.0.2 and documentserver:5.4.2.46 docker images on same server. Both services are working but opening a file in browser displays "The document could not be saved" error message.
Error message points to this url https://api.onlyoffice.com/editors/troubleshooting explaining that the callback handler is not working. "The document editing service cannot connect to the document storage service at the editorConfig.callbackUrl address."
Unsure how to set the callbackUrl any help would be greatly appreciated.
==> /var/log/onlyoffice/documentserver/docservice/out.log <==
[2020-01-08T01:32:36.164] [ERROR] nodeJS - postData error: docId = 173335947;url = http://nc.example.com/apps/onlyoffice/track?doc=eyJ0eXAiO
iJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJtaWtlIiwiZmlsZUlkIjoxMTIsImZpbGVQYXRoIjoiXC9hYmMuZG9jeCIsInNoYXJlVG9rZW4iOm51bGwsImFjdGlvbiI6InRyYW
NrIn0.EWo6KBqF6-ZtcvfrVlvJR5UFLDjmxTt8XKsNgylBv8s;data = {"key":"173335947","status":1,"users":["ocxhbukekiw0_mike"],"actions":[{"type":1,"use
rid":"ocxhbukekiw0_mike"}]}
Error: Error response: statusCode:301 ;body:
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
at Request._callback (/var/www/onlyoffice/documentserver/server/Common/sources/utils.js:301:23)
at Request.self.callback (/var/www/onlyoffice/documentserver/server/Common/node_modules/request/request.js:185:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request.<anonymous> (/var/www/onlyoffice/documentserver/server/Common/node_modules/request/request.js:1161:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage.<anonymous> (/var/www/onlyoffice/documentserver/server/Common/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
Server address for internal requests from the Document Editing" defaulted to http://nc.example.com which is wrong, https://nc.example.com is correct. Also must us FQDN not docker service name.

Error while trying to retrieve access token

In My project with Google calendar api getting error message when trying to authenticate using the code that given by the url
https://accounts.google.com/o/oauth2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar.readonly&response_type=code&client_id=353577961315-njban7i0ach9ditqeojomv18lmqlcglp.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A4200
Error message
Error while trying to retrieve access token { Error: invalid_grant
at Request._callback (C:\Users\PC\Desktop\New folder\node_modules\google-auth-library\lib\transporters.js:81:15)
at Request.self.callback (C:\Users\PC\Desktop\New folder\node_modules\request\request.js:188:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request. (C:\Users\PC\Desktop\New folder\node_modules\request\request.js:1171:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage. (C:\Users\PC\Desktop\New folder\node_modules\request\request.js:1091:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20) code: 400 }
What the reason for getting the error message and how can i resolve this issue?
There are 2 common problems that cause invalid_grant errors:
Your server's clock is out of sync with NTP
You've exceeded the refresh token limit
I'd suggest investigating whether either of these issues could be the source of your problem.

Restaging of application in Bluemix failed

Created a LoopBack application with CloudantDB as data source. Running fine when tested locally. Published the application and product successfully on Bluemix leveraging API designer.
But when I bind CloudantDB service with app on Bluemix and try to re-stage it, getting following error.can anyone help me resolve this issue? Any help in this context will be much appreciated. Thanks.
{ code: 'ESOCKETTIMEDOUT', connect: false, name: 'Error', message: 'ESOCKETTIMEDOUT', stack: 'Error: ESOCKETTIMEDOUT\n at ClientRequest. (/home/vcap/app/node_modules/request/request.js:778:19)\n at ClientRequest.g (events.js:291:16)\n at emitNone (events.js:86:13)\n at ClientRequest.emit (events.js:185:7)\n at TLSSocket.emitTimeout (_http_client.js:620:10)\n at TLSSocket.g (events.js:291:16)\n at emitNone (events.js:86:13)\n at TLSSocket.emit (events.js:185:7)\n at TLSSocket.Socket._onTimeout (net.js:339:8)\n at ontimeout (timers.js:365:14)\n at tryOnTimeout (timers.js:237:5)\n at Timer.listOnTimeout (timers.js:207:5)' }

Error: toString failed Node.js buffer

Sometimes my get request to an api fails with this error message, (btw im using the request module to trigger my requests)
Error: toString failed
buffer.js:378
throw new Error('toString failed');
^
Error: toString failed
at Buffer.toString (buffer.js:378:11)
at BufferList.toString (/home/vardha/www/abp/node_modules/bl/bl.js:155:33)
at Request.<anonymous> (/home/vardha/www/abp/node_modules/request/request.js:1013:32)
at emitOne (events.js:82:20)
at Request.emit (events.js:169:7)
at IncomingMessage.<anonymous> (/home/vardha/www/abp/node_modules/request/request.js:962:12)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:921:12)
at nextTickCallbackWith2Args (node.js:442:9)
This has been buggin me a lot since I have no idea as to whats causing this and was not able to find any clear solution in the github page. ANy help would be appreciated.
This error usually occurs when you request for file which is relatively bigger in size (or) the bufferlength exceeds / reaches 256 MB which the V8 engine will throw as an error.
This issue is still being addressed by the NodeJS community Read out this comprehensive post which has all the progress/answers that you are looking for.
https://github.com/nodejs/node/pull/4394
Hope this helps!

Resources