Skip to content

Instantly share code, notes, and snippets.

@coisme
Last active September 29, 2021 14:42
Show Gist options
  • Save coisme/a837b8ce07828deb7e670a412b81bf55 to your computer and use it in GitHub Desktop.
Save coisme/a837b8ce07828deb7e670a412b81bf55 to your computer and use it in GitHub Desktop.

Running aws-azure-login on Raspberry Pi OS

When you run aws-azure-login on Raspberry Pi, you may get an error like this:

 $ aws-azure-login --no-prompt
Logging in with profile 'default'...
Using AWS SAML endpoint https://signin.aws.amazon.com/saml
Error: Failed to launch the browser process!
/usr/local/lib/node_modules/aws-azure-login/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: 1: /usr/local/lib/node_modules/aws-azure-login/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: Syntax error: ")" unexpected


TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at onClose (/usr/local/lib/node_modules/aws-azure-login/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:197:20)
    at Interface.<anonymous> (/usr/local/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:470:12)
    at Interface.close (readline.js:451:8)
    at Socket.onend (readline.js:224:10)
    at Socket.emit (events.js:412:35)
    at Socket.emit (domain.js:470:12)
    at endReadableNT (internal/streams/readable.js:1317:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)

Requirements

  • aws-azure-login installed (How to install)
  • chromium-browser installed

If chromium-browser is not installed, install it:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install chromium-browser

Workaround

The reason is because the chrome browser installed by puppeteer when you run npm install aws-azure-login doesn't run on Raspberry Pi OS. You need to specify an available browser by PUPPETEER_EXECUTABLE_PATH environment variable. See here for details.

You can use aws-azure-login with this PUPPETEER_EXECUTABLE_PATH option.

$ PUPPETEER_EXECUTABLE_PATH=`which chromium-browser` aws-azure-login

Here is an example output:

$ PUPPETEER_EXECUTABLE_PATH=`which chromium-browser` aws-azure-login --no-prompt
Logging in with profile 'default'...
Using AWS SAML endpoint https://signin.aws.amazon.com/saml
? Password: [hidden]
We texted your phone +XX XXXXXXXX84‎. Please enter the code to sign in.
? Verification Code: 012345
Assuming role arn:aws:iam::012345678901:role/My_Role

Checked with this environment:

$ cat /proc/version
Linux version 5.10.60-v7+ (dom@buildbot) (arm-linux-gnueabihf-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1449 SMP Wed Aug 25 15:00:01 BST 2021
$ cat /etc/debian_version
10.10
$ chromium-browser --version
Chromium 92.0.4515.98 Built on Raspbian , running on Raspbian 10
$ npm list -g | grep aws-azure-login
├─┬ aws-azure-login@3.4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment