Running imagemagick on Azure with node.js - node.js

I have a website on Azure and can't seem to run imagemagick.
I have the binaries there, and have changed my javascript files to point to the imagemagick binaries. The binaries seem to be running, but they don't accept any input using stdin. When I try to write to stdin I get an error about the socket being closed
Error: This socket is closed.
at Socket._write (net.js:635:19)
at doWrite (_stream_writable.js:221:10)
at writeOrBuffer (_stream_writable.js:211:5)
at Socket.Writable.write (_stream_writable.js:180:11)
at Socket.write (net.js:613:40)
at Duplex.ImageMagick._write (\\100.68.148.84\volume-9-default\f9e21fc24431ae1e3688\d6a9b08558464073a94176eb39d78b10\site\wwwroot\node_modules\imagemagick-stream\index.js:47:17)
at Duplex.<anonymous> (\\100.68.148.84\volume-9-default\f9e21fc24431ae1e3688\d6a9b08558464073a94176eb39d78b10\site\wwwroot\node_modules\imagemagick-stream\index.js:52:12)
at Duplex.g (events.js:175:14)
at Duplex.EventEmitter.emit (events.js:95:17)
at Duplex._spawn (\\100.68.148.84\volume-9-default\f9e21fc24431ae1e3688\d6a9b08558464073a94176eb39d78b10\site\wwwroot\node_modules\imagemagick-stream\index.js:184:8)
Is there a fix for this? Is it failing because I am running a website and not a cloud service? I know that it is possible to get working somhow, because I've seen a few examples, but the examples are out of date and dont go over server configuration that much
Thanks for your help.

Related

aws-azure-login "Unable to recognize page state!"

I have trawled the net on this one and cannot find a resolution.
I have deployed an EC2 instance from a AWS RHEL 8 AMI.
I have installed all the pre-requisites for aws-azure-login but cannot connect to my accounts over SAML. (https://github.com/sportradar/aws-azure-login)
The config file has been created with parameters. When running aws-azure-login it returns the username, I press enter and then it hangs for minutes and returns the following error:
Unable to recognize page state! A screenshot has been dumped to aws-azure-login-unrecognized-state.png. If this problem persists, try running with --mode=gui or --mode=debug
After running in debug i get the following output:
Logging in with profile 'default'...
Using AWS SAML endpoint https://signin.aws.amazon.com/saml
Error: Failed to launch the browser process!
[13527:13527:1220/050718.762168:ERROR:browser_main_loop.cc(1409)] Unable to open X display.
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/usr/lib/node_modules/aws-azure-login/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:197:20)
at Interface.<anonymous> (/usr/lib/node_modules/aws-azure-login/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:187:68)
at Interface.emit (events.js:412:35)
at Interface.emit (domain.js:475:12)
at Interface.close (readline.js:530:8)
at Socket.onend (readline.js:254:10)
at Socket.emit (events.js:412:35)
at Socket.emit (domain.js:475:12)
at endReadableNT (internal/streams/readable.js:1334:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Node version = v14.18.2
Any pointers would be greatly appreciated.
Note: on Linux you will likely need to disable the Puppeteer sandbox
or Chrome will fail to launch:
aws-azure-login --no-sandbox
If not check Unable to open X display when trying to run google-chrome on Centos (Rhel 7.5)
I bumped into same issue on CentOS7
aws-azure-login --profile <profile_name> --no-prompt --no-sandbox --enable-chrome-network-service --no-verify-ssl
worked for me, hope I helped anyone
I was getting the same error but then I end up recreating a new profile name. This time, I made sure that my profile name was one word, all lower case, and only characters was used. Example: automation

What's "EIO: i/o error, write" in node.js and how do I eliminate it?

I have a node.js app using elasticsearch to gather error data and notify relevant stack holders. It starts to give me errors lately (no change has made to the code):
write EIO
Error: write EIO
at afterWriteDispatched (internal/stream_base_commons.js:154:25)
at writeGeneric (internal/stream_base_commons.js:145:3)
at WriteStream.Socket._writeGeneric (net.js:783:11)
at WriteStream.Socket._write (net.js:795:8)
at doWrite (_stream_writable.js:385:12)
at writeOrBuffer (_stream_writable.js:367:5)
at WriteStream.Writable.write (_stream_writable.js:307:12)
at Stdio.write (/project/node_modules/elasticsearch/src/lib/loggers/stdio.js:58:6)
at Stdio.onError (/project/node_modules/elasticsearch/src/lib/loggers/stdio.js:70:8)
at Log.wrapper (/project/node_modules/lodash/lodash.js:4929:19)
at Log.emit (events.js:315:20)
at Log.error (/project/node_modules/elasticsearch/src/lib/log.js:239:17)
at checkRespForFailure (/project/node_modules/elasticsearch/src/lib/transport.js:298:18)
at HttpConnector.<anonymous> (/project/node_modules/elasticsearch/src/lib/connectors/http.js:171:7)
at ClientRequest.wrapper (/project/node_modules/lodash/lodash.js:4929:19)
at ClientRequest.emit (events.js:315:20)
I suspect this has to do with some type of I/O error on the disk. What can I do to eliminate the error? I am using Node.js v14.0.0 and elasticsearch (npm package) 16.7.1.
This can be caused by multiple reasons:
If you are using Windows is most likely a unicode issue you can fix by executing chp command like this chcp 850 but if you need Unicode characters then iconv-lite module should help
When trying to write to a closed terminal
Disk related issues, like the disk is full or OS issues... when trying to write the output
Try to reinstall the modules to the latest version and from scratch since maybe you are using a buggy module or it wasn't installed correctly
This turns out to be a bug in ElasticSearch's log feature due to the fact it is writing to the stdio synchronously. We will either have to turn off the log or use a third party logger.

Errror which crashed the my hosted node.js server file which is run on fore erver command

My node.js server file which is hosted on a server is used by my various applications like mobile apps and desktop app.
At some time my server file which is run through forever command crashes and my whole front end system goes down. Why does the server file crash?
Type Error: Cannot read property 'fragmentedOperation' of null
at Receiver.endPacket (C:\Users\root\Desktop\Server\windowsnodefiles\node-v6.10.3-win-x64\node_modules\socket\node_modules\ws\lib\Receiver.js:247:18)
at Receiver.finish (C:\Users\root\Desktop\Server\windowsnodefiles\node-v6.10.3-win-x64\node_modules\socket.io\node_modules\ws\lib\Receiver.js:483:12)
at Receiver.<anonymous> (C:\Users\root\Desktop\Server\windowsnodefiles\node-v6.10.3-win-x64\node_modules\socket.io\node_modules\ws\lib\Receiver.js:451:33)
at Receiver.add (C:\Users\root\Desktop\Server\windowsnodefiles\node-v6.10.3-win-x64\node_modules\socket.io\node_modules\ws\lib\Receiver.js:95:24)
at Socket.realHandler (C:\Users\root\Desktop\Server\windowsnodefiles\node-v6.10.3-win-x64\node_modules\socket.io\node_modules\ws\lib\WebSocket.js:800:20)
at emit One (events.js:96:13)
at Socket.emit (events.js:188:7)
at readability (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at Nonreactive (net.js:547:20)
error: Forever detected script exited with code: 1
error: Script restart attempt #2
Error: %1 is not a valid Win32 application.
If you are using browserSync library then you can check this link
rollback the browserSync version to ^2.6.4 and it works
or try updating your socket.io package as per this link
Please check if your issue is fixed with the latest release

Fresh meteor 1.3 on win7 not runnning

I am also posting this on stackoverflow as this is suggested by meteor itself :)
I upgraded my meteor project to Meteor 1.3, and after updating all the proper packages I could not get meteor 1.3 to run. Then I created a fresh project and still get this error I posted below. I also tried to create the simple-todos example shown here https://www.meteor.com/tutorials/blaze/creating-an-app in CMD. Same result.
Windows 7 btw :) Also I have not installed meteorhacks:npm or any other extra packages whatsoever.
http.js:733
throw new TypeError('The header content contains invalid characters');
^
TypeError: The header content contains invalid characters
at ClientRequest.OutgoingMessage.setHeader (http.js:733:13)
at new ClientRequest (http.js:1429:14)
at Object.exports.request (http.js:1899:10)
at Array.stream [as 3] (C:\Users\Lightspeed\AppData\Local\.meteor\packages\meteor-tool\1.3.0_3\mt-os.windows.x86_32\dev_bundle\lib\node_modules\http-proxy\lib\http-proxy\passes\web-incoming.js:108:74)
at ProxyServer.<anonymous> (C:\Users\Lightspeed\AppData\Local\.meteor\packages\meteor-tool\1.3.0_3\mt-os.windows.x86_32\dev_bundle\lib\node_modules\http-proxy\lib\http-proxy\index.js:80:21)
at Proxy._tryHandleConnections (C:\tools\runners\run-proxy.js:182:20)
at Server.<anonymous> (C:\tools\runners\run-proxy.js:50:12)
at Server.emit (events.js:98:17)
at HTTPParser.parser.onIncoming (http.js:2164:12)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:152:23)
at Socket.socket.ondata (http.js:2022:22)
at TCP.onread (net.js:528:27)
Meteor does startup properly and does not crash until I actually navigate to localhost:3000. The page immediately errors (host not reachable) and meteor crashes with the error shown in my OP.
This problem was related to a specific windows 7 version. Though I don't have specifics anymore, it has been resolved.

How can I update Node.JS through JXCore?

I'm getting this error when trying to use the Steam API:
var cryptedSessKey = require('crypto').publicEncrypt(fs.readFileSync(__dirna
^
TypeError: Object # has no method 'publicEncrypt'
at SteamClient.handlers.(anonymous function) (/usr/local/psa/var/modules/jxcore-support/native_modules/node_modules/steam/lib/steam_client.js:150:42)
at SteamClient.netMsgReceived (/usr/local/psa/var/modules/jxcore-support/native_modules/node_modules/steam/lib/steam_client.js:106:26)
at Connection.emit (events.js:82:15)
at Connection._readPacket (/usr/local/psa/var/modules/jxcore-support/native_modules/node_modules/steam/lib/connection.js:50:8)
at Connection.emit (events.js:79:15)
at emitReadable (_stream_readable.js:383:10)
at emitReadable (_stream_readable.js:379:5)
at readableAddChunk (_stream_readable.js:143:31)
at Connection.Readable.push (_stream_readable.js:107:10)
at TCP.onread (net.js:489:18)
Spawner error: Application exited by itself with code: 8
Spawner info: Subscribing is delayed by 2000 ms.
Spawner info: Subscribed successfully: Successfully subscribed process 25525 to the monitor.
The fix is to apparently upgrade my node.js to version v0.12. As stated here: https://github.com/seishun/node-steam/issues/121
How can I do this? I'm using JXCore extension for Plesk.
I've tried SSHing in and running update commands but it doesn't seem to recognise node. Do I have to browse to a certain directory? I can't even run node --version because it's all within JXCore (I assume).
I have the lastest version of JXCore (Installed v Beta-0.3.0.2).
I'm assuming I'm just being an idiot somehow but I'm still new to node.js.
Can anyone help me?
Thank you
Jack
I asked the same question on their Github and this was their response:
JXcore v 0.3 is based on Node 0.10. AFAIK that module has node 0.10
compatible version too. You should use that. We are planning to bring
new crypto API from 0.12 soon.
Therefore, for now, you can't update it.

Resources