aws-azure-login "Unable to recognize page state!" - node.js

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

Related

In Linux how do you set it that Google Chrome runs in debugging mode by default

I specifically need this for puppeteer to open a window in my current browser so that my user data can be accessed and I can login to places automatically
In Windows, you enable the setting by adding this to the shortcut icon's 'target' field, '–remote-debugging-port=9222'
This will automatically run Chrome with that setting so you have all your login sessions available
How can I have the same effect in Linux where I enable the setting permanently?
There is a way to run Chrome in this way by running /usr/bin/google-chrome-stable --remote-debugging-port=9220 in your terminal, but where can I edit a file to have this permanently enabled?
I've also run into a small error right now trying to start my puppeteer script.
FetchError: Failed to fetch browser webSocket URL from http://localhost:9222/json/version: request to http://localhost:9222/json/version failed, reason: connect ECONNREFUSED 127.0.0.1:9222
at ClientRequest.<anonymous> (/home/me/Coding/whatsapp-bot-puppeteer/node_modules/node-fetch/lib/index.js:1461:11)
at ClientRequest.emit (node:events:526:28)
at Socket.socketErrorListener (node:_http_client:442:9)
at Socket.emit (node:events:526:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
type: 'system',
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED'
}
I'm Linux noob, so I need some help please ^-^
I have found a slight workaround, but it does require you to create a chrome instance through the terminal and then use a websocket connection string
You will also have to log into your new chrome window and sign in wherever
/usr/bin/google-chrome-stable --remote-debugging-port=9222 --no-first-run --no-default-browser-check --user-data-dir=remote-profile
Running this in a Linux terminal will provide you with a ws connection you copy and then paste into your puppeteer script
Please look here for an example:
https://blog.nutjane.me/how-to-run-puppeteer-with-existing-chrome-profile-f42954bfc70c
You just have to make sure not to close this browser instance if you're planning on having a puppeteer script run the whole time. Otherwise you'll have to restart the chrome browser from the terminal and update the ws connection string in your puppeteer file :)
I've tested a quick script with puppeteer now, and I am having success with it :D

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

Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED

I am trying to run the Hyperledger fabric Tuna app and getting the below error when running the regiseterAdmin.js
Store path:/home/chaindev/.hfc-key-store
Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 127.0.0.1:7054]
at ClientRequest.<anonymous> (/home/chaindev/fabricProjects/src/github.com/education/LFS171x/fabric-material/tuna-app/node_modules/fabric-ca-client/lib/FabricCAClientImpl.js:711:12)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at Socket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Failed to enroll admin: Error: Failed to enroll admin
The issue was occurring for me because I had the wrong Private Key name mentioned in the docker-compose.yml file
FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/4239aa0dcd76daeeb8ba0cda701851d14504d31aad1b2ddddbac6a57365e497c_sk
When I re-generated the artificats the key file name was changed and after correction everything worked fine.
Also thanks for rocket-fabric group for mentioning the commands on how to look for logs in docker container. Below commands can be useful to debug
docker ps -a
docker logs <ca container name>
The docs need be updated on this. Localhost 127.0.0.1 does not work for Docker For Windows and Docker Toolbox as they both give their run-time IP address on start of Docker (here taken as 192.168.1.2).
This start-up IP needs to be updated in the registerAdmin.js file (or in my case enrollAdmin.js file as referred in the Tutorial "Writing First App" ).
The enrollAdmin.js needs be updated in this line:
// be sure to change the http to https when the CA is running TLS enabled
fabric_ca_client = new Fabric_CA_Client('http://192.168.1.2:7054', tlsOptions , 'ca.example.com', crypto_suite);
The output certificate should be like:
Successfully enrolled admin user "admin"
Assigned the admin user to the fabric client :: "name":"admin","mspid":"Org1MSP","roles":null,"affiliation":"","enrollmentSecret":"","enrollment": "signingIdentity":"c198861140fc723abc058c70d23395a2d7b73c926ca673b53d713053aaade419","identity":{"certificate":"-----BEGIN CERTIFICATE-----\nMIICATCCAaigAwIBAgIUK/o2ege+nT73jK/NXSgYIKoZIzj0EAwIw\nczELM...QnCkD6AiApKxxU1maQIt1TKFl3KYZWGBNDSSa6SCbob7q1p5xfpQ==\n-----END CERTIFICATE-----\n"}}}
Similar problem solved here.
As your .hfc-key-store directory is in chaindev,
Try running the following commands:
$ cd ~/chaindev/
$ rm -rf .hfc-key-store/
Then, run the command:
$ node registerAdmin.js
This can also happen if the port in PeerAdmin#Org.card does not match the port in docker-compose.yaml, I had hard time finding solution to this problem.
Mismatch in connection protocols, either you have done fabric setup without TLS and trying to connect to CA using https protocol or vice-versa.
Run docker ps and check if all the docker containers are running or not.
If it is not running run it, if it fail, download the fabric binaries.
I have the same error.
I run networkDown.sh and the run startFabric.sh again.Then it succeeded.

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.

Running imagemagick on Azure with 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.

Resources