dimkir / nightmare-lambda-tutorial

Sample project and tutorial to run NightmareJS on AWS Lambda
75 stars 9 forks source link

_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created. #10

Open paulchill opened 5 years ago

paulchill commented 5 years ago

When i execute the stock tutorial to start in a docker lambda image I get :

_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.

Any help would be great. i can't get Xfvb to work!

dimkir commented 5 years ago

Hmm... Maybe discussion under this thread can give you some pointers: https://phabricator.wikimedia.org/T202710

Seems like problem may be related to mismatch of users when executing container...

paulchill commented 5 years ago

Thanks, v much. I think that helps.

Can chrome extensions be added into electron with nightmare?

dimkir commented 5 years ago

If I paraphrase your question:

Can chrome extensions be added into electron using nightmare commands at runtime?

If I have to guess, my thoughts would be: essentially nightmare probably communicates with Chrome via some kind of 'webdriver/selenium protocol'. If that protocol allows adding extensions at runtime then it will, if it doesn't allow adding extensions at runtime - then it doesn't.

I found this link https://electronjs.org/docs/tutorial/devtools-extension which shows that there's some kind of API for adding some extensions at some moment of Electron lifecycle. Maybe it may help you.

Can chrome extensions be added into electron, so that when I test some pages via nightmare at runtime, the extension is enabled?

This question basically boils down to: can I create custom assembly/package of Electron with some chrome extensions bundled.

Again you may check the same page https://electronjs.org/docs/tutorial/devtools-extension to investigate whether "some API, some extensions, at some time" translates into "right API for my extension, in the right moment of Electron lifecycle". Hope this helps.

ps. Also if you have future questions, please post them as separate threads. pps. Also if you have solved the original "_XSERVTransmkdir" issue, would be awesome if you describe what worked for you and why you were actually getting it.

dzmitry-kankalovich commented 3 years ago

I hit the same problem.

Followed instructions here https://www.npmjs.com/package/aws-lambda-ric and made image which passes local test, per instruction.

However, deployed to actual lambda it fails with

_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.

The problem seems to be in the fact that Xvfb - for whatever weird reason - wants root access to create that folder - it's not going to happen in Lambda.

Is there anything we can do about it? I wonder how it used to work before

adatta02 commented 2 years ago

I hit this problem trying to use Xvfb on a different project (and hit this issue via Google). If you launch Xvfb with "-nolisten tcp -nolisten unix" I can confirm that does work on Lambda. My full entrypoint for a nodejs based Lambda is:

xvfb-run -e /dev/stdout -s "-screen 0 1280x1024x24 -ac -nolisten tcp -nolisten unix" /usr/bin/npx aws-lambda-ric app.handler
DiMiTriFrog commented 2 years ago

I hit this problem trying to use Xvfb on a different project (and hit this issue via Google). If you launch Xvfb with "-nolisten tcp -nolisten unix" I can confirm that does work on Lambda. My full entrypoint for a nodejs based Lambda is:

xvfb-run -e /dev/stdout -s "-screen 0 1280x1024x24 -ac -nolisten tcp -nolisten unix" /usr/bin/npx aws-lambda-ric app.handler

Could you share Dockerfile or code?

adatta02 commented 2 years ago

@DiMiTriFrog sure thing. This is specific to editly

I also added aws-lambda-ric via npm to the editly package.json

https://gist.github.com/adatta02/a2cebb9105051a526ce3f8b2c1cb16b5