-
Notifications
You must be signed in to change notification settings - Fork 53
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
page.goto() throwing error continuously in AWS Lambda with playwright-aws-lambda #74
Comments
We saw this when the runtime version (
to
Switching to manual and using the former fixed for us. Related: |
@alecmocatta Thank you! That helped. |
For someone using ap-northeast-2:
|
I can confirm that this issue is affecting the us-west-1 region. Everything was working perfectly fine up to On 04-24-2024 I noticed our code was experiencing the "goto" issues others have described, like this error. It would not matter what site I tried to "goto" the error would always get thrown. I had a devil of a time trying to diagnose the issue. I even containerized (in a Docker image) my node.js code which presented a whole series of other UN-related issues... In a last-ditch effort for some sort of sanity-check, I came here and found that I was not alone in this issue!!! I can confirm that the runtime My solution was to edit the AWS Lambda Function Runtime Settings and manually enter the old arn that was previously working, aka nodejs:18.v26, This is a temporary solution. We all need to find a way to update this Module so that it is compatible with the current versions of the AWS node.js runtime. How can I help??? |
Hi FYI, same issue started happening since Any permanent solutions for this? |
going into the AWS console and switching this also resolved the problem for us (although we are on us-west-2, but otherwise same). however, our project is terraform managed, and from what i can tell, there is no way to specify a specific nodejs runtime arn as part of terraform, although there looks to be a request for that here. curious to know if anyone has a solution for this im not aware of, as otherwise this prevents our deploy flow from working without significant manual steps |
I completely resolved my issue with a pretty dramatic solution. Unfortunately, it won't be the ideal solution for everyone. Since the underlying issue seems to be a compatibility conflict with the AWS node.js runtime updates will, most likely, continue to be problematic for the My Solution was to migrate our existing node.js application code into a Docker image to power an AWS Lambda Function from an AWS ECR image. The original code, before the version conflict problems, was written for the AWS version of node.js 18. Which stopped working when the AWS Lambda Function node.js Runtime was updated to I accepted the challenge of containerizing my application code, which was a long overdue item on my to-do list. Given that the container configuration would be fully isolated from the AWS data center, I decided to fully upgrade to node.js 20 and the most current versions of all modules. Before you ask, NO I migrated my code to work with node.js 20 and the Full Version of Playwright. This is totally worth the effort. If you have your AWS Lambda Function powered by an image, stored in the AWS ECR (registry) then your image can be up to 10 GB in size before Lambda complains. This is awesome because you have a lot of storage overhead as your code starts to expand its module requirements. The biggest advantage of containerizing your code is that YOU are FULLY in control of the runtime environment which will NEVER change unless YOU make the change to the dependencies or the underlying runtime software! A quick word of caution... If your code is going to run on an AWS Lambda Function with an x86 CPU, YOU MUST BUILD THE DOCKER IMAGE ON AN x86 CPU LOCALLY. NO, you can't build the Docker image on Apple silicone or a Desktop ARM CPU and run it on an AWS Lambda Function even if the function is configured to run with an ARM CPU. The Amazon Graviton2 ARM CPU used in AWS is missing multiple instruction sets that a desktop ARM CPU has. TRUST ME this was a big issue for me because I'm 100% a Mac guy with mostly Apple silicone in all my devices. You can write your code in VS Code on an M1, M2, M3, M4 Mac with no problem. THEN you MUST build the Docker image on an Intel (Mac) CPU. I just sync a folder between my M1 laptop and my Intel Mac, building the docker image (and pushing it to ECR) with the Intel Mac. I will include my version of You should ONLY use them for research purposes and DO NOT use them without adapting to your environment. I wish you all well and hope this information is helpful. I can now confirm that my code is running faster and more stable than it ever has since I containerized it in a Docker image. BEST OF LUCK! Lugfug Dockerfile Example:
package.json:
|
@StevenSawtelle If you want to specify nodejs runtime arn through terraform give this a try. We are using the same and it works!
ARN** - Your Lambda function arn. |
Going from the latest ( |
For anyone in the
|
you're awesome, thanks for this idea! for others: i had to tweak this a decent bit to include an hope this issue still gets resolved so we can go back to auto runtime instead of being stuck on this one, but i'm super happy we dont have to worry about this in the meantime :) |
Hi, Anyone facing similar issue with Node.js v20? |
After trying various approaches and coming up against "context or browser has been closed" sometimes consistently, sometimes intermittently I decided to go with the recommendation from lugfug and build a custom container image. My dockerfile looks like this:
|
Lambda 1:
playwright-aws-lambda v0.9.0
Node 16
Lambda 2:
playwright-aws-lambda v0.10.0
Node 18
AWS Lambda
CI/CD Gitlab
When trying to go to a URL with page.goto(), getting continuous error - 'Error: page.goto: Target page, context or browser has been closed'.
At handler level the error says - "TypeError: Cannot read properties of undefined (reading 'close')\n at d. (/var/task/src/handler.js:1:17387)\n at Generator.next ()\n at a (/var/task/src/handler.js:1:15631)"
The above error in occurring in lambdas which got built by Gitlab pipeline on/after April 18. The same code is still working fine for the lambdas that were build and deployed before April 18.
The deployment packages for old and new deployments are totally same - node module versions and configs.
Any recent updates somewhere would have affected this? TIA.
The text was updated successfully, but these errors were encountered: