-
Notifications
You must be signed in to change notification settings - Fork 245
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
[BUG] Cannot initialize Playwright in rootless container #2770
Comments
Looks like your user has no permissions to access /app. Have you tried the following instead of chmod?
This will give your user permission to /app. |
Correct me if I'm wrong, but doesn't
|
I see! So the executable bit of Investigation: When we download the drivers before creating the nuget files we seem to be doing the right thing:
While on the user side the executable bit is only set for user:
Workaround would be cc @campersau looks like when we pack the bit gets filtered out? |
The problem is that NuGet pack and also extract does not preserve the executable bit, in fact any "external" attribute is ignored. It might be possible to workaround it by adding some more logic to NuGet uses the Pack and extract only tries to preserve timestamps. Pack: |
@mxschmitt would it be possible to add app@d9c7ae175924:/app$ ls -lh .playwright/node/linux-x64/
total 92M
-rwxr--r-- 1 root root 92M Jan 19 23:07 node ...which leads to the following error when running my rootless container: System.ComponentModel.Win32Exception (13): An error occurred trying to start process '/app/.playwright/node/linux-x64/node' with working directory '/app'. Permission denied
at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at Microsoft.Playwright.Transport.StdIOTransport.StartProcessWithUTF8IOEncoding(Process process) in /_/src/Playwright/Transport/StdIOTransport.cs:line 168
at Microsoft.Playwright.Transport.StdIOTransport..ctor() in /_/src/Playwright/Transport/StdIOTransport.cs:line 47
at Microsoft.Playwright.Playwright.CreateAsync() in /_/src/Playwright/Playwright.cs:line 44
at ScreenshotCreator.Logic.PlaywrightHelper.InitializePlaywrightAsync() in /src/src/ScreenshotCreator.Logic/PlaywrightHelper.cs:line 36
at ScreenshotCreator.Logic.ScreenshotCreator.CreateScreenshotAsync(UInt32 width, UInt32 height) in /src/src/ScreenshotCreator.Logic/ScreenshotCreator.cs:line 14
at ScreenshotCreator.Api.BackgroundScreenshotCreator.ExecuteAsync(CancellationToken stoppingToken) in /src/src/ScreenshotCreator.Api/BackgroundScreenshotCreator.cs:line 32
at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
Unhandled exception. System.ComponentModel.Win32Exception (13): An error occurred trying to start process '/app/.playwright/node/linux-x64/node' with working directory '/app'. Permission denied
at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at Microsoft.Playwright.Transport.StdIOTransport.StartProcessWithUTF8IOEncoding(Process process) in /_/src/Playwright/Transport/StdIOTransport.cs:line 168
at Microsoft.Playwright.Transport.StdIOTransport..ctor() in /_/src/Playwright/Transport/StdIOTransport.cs:line 47
at Microsoft.Playwright.Playwright.CreateAsync() in /_/src/Playwright/Playwright.cs:line 44 This error disappears when using (see here): FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
RUN chmod +x /app/.playwright/node/*/node
ENTRYPOINT ["dotnet", "ScreenshotCreator.Api.dll"] |
We actually got rid of the playwright-dotnet/src/Playwright/build/Microsoft.Playwright.targets Lines 60 to 66 in 48aec35
Are you on 1.41.2? |
1.40.0 |
Could you try 1.41.2? |
I'm on |
Do you have any idea what the problem might be, @mxschmitt ? |
Some guesses would be that the user has no permission to run the driver aka. Node.js. Maybe the permission bits get lost when using |
Thx for that hint! You're right: when running Thx for your help and take care 🙂 |
System info
v1.40.0
Source code
Link to the GitHub repository with the repro
https://github.com/mu88/ScreenshotCreator/tree/feature/repro-Playwright
Test file (self-contained)
/
Steps
feature/repro-Playwright
from https://github.com/mu88/ScreenshotCreator/docker build --platform linux/amd64 -f .\src\ScreenshotCreator.Api\Dockerfile -t screenshotcreator:dev .
docker run --name screenshotcreator -p:8080:8080 screenshotcreator:dev
Expected
The app starts without errors.
Actual
Starting the app fails with the following error:
Comments
When either adding
RUN chmod -R 777 /app
(see here) or using a root container, everything works as expected.The text was updated successfully, but these errors were encountered: