I am running this app. https://github.com/azat-co/practicalnode
chapter 5- blog-express app.
the only change is twitter consumer key and secret I made in app.js file
I can run this app and sign-in with twitter.
But when I try to post an article it causes error.
Connect
400 Error: request size did not match content length
at makeError (/home/myname/Documents/nodejs/practicalnode/ch7/blog-express/node_modules/body-parser/node_modules/raw-body/index.js:136:15)
at IncomingMessage.onEnd (/home/myname/Documents/nodejs/practicalnode/ch7/blog-express/node_modules/body-parser/node_modules/raw-body/index.js:106:13)
at IncomingMessage.g (events.js:180:16)
at IncomingMessage.emit (events.js:92:17)
at _stream_readable.js:938:16
at process._tickCallback (node.js:419:13)
What should I check?what could be wrong.
thanks
Related
I'm trying to setup a Node.js Websocket server over at my webhost (Namecheap). However, I am getting this error:
events.js:292
throw er; // Unhandled 'error' event
^
Error: Unexpected server response: 301
at ClientRequest.<anonymous> (D:\****\node_modules\ws\lib\websocket.js:576:7)
at ClientRequest.emit (events.js:315:20)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
at TLSSocket.socketOnData (_http_client.js:469:22)
at TLSSocket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at TLSSocket.Readable.push (_stream_readable.js:212:10)
at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)
Emitted 'error' event on WebSocket instance at:
at abortHandshake (D:\****\node_modules\ws\lib\websocket.js:694:15)
at ClientRequest.<anonymous> (D:\****\node_modules\ws\lib\websocket.js:576:7)
[... lines matching original stack trace ...]
at TLSSocket.Readable.push (_stream_readable.js:212:10)
The code for the client and server came from here:
https://github.com/websockets/ws#Simple server
https://github.com/websockets/ws#sending-and-receiving-text-data
with ws://www.host.com/path changed to ws://<mydomainname>/<dir1>/<dir2>
Both client and server code runs properly when run locally. Http related code runs properly when used on my webhost. I am trying to get the client code to run locally and connect via websockets to my server hosted at Namecheap.
I suspect something related to the server is preventing connection. I'd ask support but I doubt if they can resolve this. Maybe there's a locked feature or something? Is there something else I could have missed?
Websockets cannot work on Namecheap's hosted servers. Their incoming ports are blocked and cannot be opened for security reasons per their customer's support.
If anyone is looking for a solution just in case, try out a Heroku free account.
I'm working on a Discord BOT using Node.js
I'm trying to get an image using a public API with no key needed, it's working locally but when I deploy it on Heroku, it doesn't work.
I need to know if Heroku is limiting the API requests and I should upgrade my "free" plan or I'm missing something.
Error message when trying to call the API :
2020-06-02T22:37:20.973482+00:00 app[worker.1]: Mister Secret is online !
2020-06-02T22:37:47.205353+00:00 app[worker.1]: rpstorydiscord just joined the server.
2020-06-02T22:37:49.831240+00:00 app[worker.1]: Error: Server responded with 403
2020-06-02T22:37:49.831256+00:00 app[worker.1]: at /app/node_modules/canvas/lib/image.js:56:28
2020-06-02T22:37:49.831257+00:00 app[worker.1]: at /app/node_modules/simple-get/index.js:89:7
2020-06-02T22:37:49.831258+00:00 app[worker.1]: at PassThrough.<anonymous> (/app/node_modules/simple-concat/index.js:7:13)
2020-06-02T22:37:49.831258+00:00 app[worker.1]: at Object.onceWrapper (events.js:421:28)
2020-06-02T22:37:49.831258+00:00 app[worker.1]: at PassThrough.emit (events.js:315:20)
2020-06-02T22:37:49.831259+00:00 app[worker.1]: at endReadableNT (_stream_readable.js:1221:12)
2020-06-02T22:37:49.831259+00:00 app[worker.1]: at processTicksAndRejections (internal/process/task_queues.js:84:21)
The API request looks like this :
https://api.habbocity.me/avatar_image.php?user=PSEUDO&headonly=0&direction=3&head_direction=3&size=l
Thank you for your help.
Your API call was blocked with a site-wide CAPTCHA from the web host Cloudflare. Any call to that domain is blocked with the CAPTCHA, unless you get a token from their "privacy-pass" extension/plug-in.
It worked on localhost because you already have such a token downloaded.
when i call a POST endpoint from npm request module in my nodejs app (hosted on elasticbeanstalk aws). it gives me CERT_HAS_EXPIRED error, however my ssl certificate is valid and works perfectly when someone visit our site.
this started happening randomly 3 days earlier.
does anyone know what can be done? to fix it?
{ Error: certificate has expired
at TLSSocket.<anonymous> (_tls_wrap.js:1088:38)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:188:7)
at TLSSocket._finishInit (_tls_wrap.js:610:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:440:38) code: 'CERT_HAS_EXPIRED' }
So #Salahi's comment was correct, support.sectigo.com/Com_KnowledgeDetailPage?Id=kA03l00000117LT
it wasn't a problem on our end, but one of the root certificates expired for the services we were trying to access, and therefore were receiving this error.
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!
I want to register on http://nodester.com/. I got my coupon, registered on site, installed nodester (npm install nodester-cli -g)
and user setup command (nodester user setup gio.beri#gmail.com pass***) gives me error:
nodester info verifying credentials
/usr/local/lib/node_modules/nodester-cli/node_modules/nodester-api/node_modules/request/vendor/cookie/index.js:45
: url.parse(req.url).pathname;
^
TypeError: Cannot read property 'url' of undefined
at new Cookie (/usr/local/lib/node_modules/nodester-cli/node_modules/nodester-api/node_modules/request/vendor/cookie/index.js:45:20)
at /usr/local/lib/node_modules/nodester-cli/node_modules/nodester-api/node_modules/request/main.js:432:33
at Array.forEach (native)
at Request. (/usr/local/lib/node_modules/nodester-cli/node_modules/nodester-api/node_modules/request/main.js:426:46)
at Request.emit (events.js:64:17)
at IncomingMessage. (/usr/local/lib/node_modules/nodester-cli/node_modules/nodester-api/node_modules/request/main.js:391:16)
at IncomingMessage.emit (events.js:81:20)
at HTTPParser.onMessageComplete (http.js:133:23)
at CleartextStream.ondata (http.js:1231:22)
at CleartextStream._push (tls.js:303:27)
Can anyone suggest anything?
EDIT:
I think that problem is in my password. what must me there coupon???