Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple question #30

Closed
yarikbratashchuk opened this issue Jun 30, 2017 · 6 comments
Closed

Simple question #30

yarikbratashchuk opened this issue Jun 30, 2017 · 6 comments

Comments

@yarikbratashchuk
Copy link

yarikbratashchuk commented Jun 30, 2017

Hello)
@adieuadieu, could u, please, explain for me some simple stuff:

How is that possible that chrome can bind to the port 9222 on aws lambda?
Does it binds to a port at all?
I'm asking because i want to use binary with cdp client written in go.
Will it work at all?

Sincerely

@adieuadieu
Copy link
Owner

Hi @yarikbratashchuk. I'm not sure I understand your question. Chrome binds to port 9222 just like any other program can bind to a port. Lambda doesn't forbid you from creating ports. You should be able to use Go to connect to port 9222 from within a Lambda invocation. However, you won't be able to connect to the port from outside of the Lambda function. Lambda functions do not have a public IP.

@yarikbratashchuk
Copy link
Author

yarikbratashchuk commented Jul 3, 2017

@adieuadieu thank u for the answer)
The go client makes get request to http://127.0.0.1:9222/json/new, but gets "context deadline exceeded", that is why i asked, it doesn't work for me for now.
How much memory this lambda probably needs?

@adieuadieu
Copy link
Owner

Hi @yarikbratashchuk. I'm not familiar with that error message. Is there any more information in the function's CloudWatch logs? I would recommend running the function with at least 1024 MB of memory. I usually use the maximum 1536 MB. Chrome is not.. lightweight.

@yarikbratashchuk
Copy link
Author

yarikbratashchuk commented Jul 3, 2017

@adieuadieu, this is what i get when try to test function via aws lambda dashboard:
Get http://localhost:9222/json/new: dial tcp 127.0.0.1:9222: getsockopt: connection refused,
but sometimes i get http://localhost:9222/json/new: dial tcp 127.0.0.1:9222: EOF.

context deadline exceeded means that some time has passed but it didn't get a response from http://127.0.0.1:9222/json/new.
Does headless_shell depends on some js stuff, to work?
Does it matter how i invoke lambda?

What is weird is that max memory used
is only 31 MB. As for me it just can't be enough.
And duration is 5258.77 ms.

Thanks a lot for any thoughts

@adieuadieu
Copy link
Owner

adieuadieu commented Jul 3, 2017

Hm..

Launch the headless_shell with --disable-gpu --single-process --no-zygote --no-sandbox flags. If you want logging, add --enable-logging --log-level=0 --v=99. Try to capture or log the output from headless_shell to CloudWatch (in JS this is done with console.log.) There's usually some kind of error that gets logged to stdout/stderr by headless_shell if something went wrong.

@yarikbratashchuk
Copy link
Author

@adieuadieu, seems like no logs on startup. I'm going to leave my go implementation and use your project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants