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

File Download Fails with net::ERR_ABORTED #670

Open
Taurinz359 opened this issue Dec 11, 2024 · 0 comments
Open

File Download Fails with net::ERR_ABORTED #670

Taurinz359 opened this issue Dec 11, 2024 · 0 comments

Comments

@Taurinz359
Copy link

Hi everyone,

Everything was working perfectly until I needed to implement file download functionality. I’m running into an issue where the download process seems to start but then fails with the error: "errorText":"net::ERR_ABORTED".

Environment:
Docker: Alpine
PHP: 8.3
Chromium: Running in the same setup
Code for Download:
Here’s the code I’m using for the download process:

$browserFactory = new BrowserFactory('/usr/bin/chromium-browser');
$browser = $browserFactory->createBrowser([
    'debugLogger' => storage_path('logs/chrome.log'),
]);
$page = $browser->createPage();
$page->navigate($link)->waitForNavigation();
$page->setDownloadPath(storage_path('app/public/tmp'));
$elem = $page->dom()->querySelector('#btn_download');
$elem->click();

Logs:

[2024-12-11T12:06:24.448640+00:00] chrome.DEBUG: socket(1): ← receiving data:{"method":"Network.requestWillBeSentExtraInfo","params":{"requestId":"6E80EC23A87FD5D918CF3DDA78E66A0D","associatedCookies":[{"cookie":{"name":"csrftoken","value":"QnzyupSxcTSOOWtxg1Iblk7LyRrvS3nC","domain":"tiny-files.com","path":"/","expires":1765368363.824559,"size":41,"httpOnly":false,"secure":false,"session":false,"priority":"Medium","sameParty":false,"sourceScheme":"Secure","sourcePort":443},"blockedReasons":[],"exemptionReason":"None"}],"headers":{":authority":"tiny-files.com",":method":"POST",":path":"/59b97e122533b93c2de05c1d/2817096/This%20is%20Going%20to%20Hurt%20by%20Adam%20Kay.epub/",":scheme":"https","accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","accept-encoding":"gzip, deflate, br","cache-control":"max-age=0","content-length":"1042","content-type":"application/x-www-form-urlencoded","cookie":"csrftoken=QnzyupSxcTSOOWtxg1Iblk7LyRrvS3nC","origin":"https://tiny-files.com","priority":"u=0, i","referer":"https://tiny-files.com/59b97e122533b93c2de05c1d/2817096/This%20is%20Going%20to%20Hurt%20by%20Adam%20Kay.epub/","sec-ch-ua":"\"Chromium\";v=\"124\", \"HeadlessChrome\";v=\"124\", \"Not-A.Brand\";v=\"99\"","sec-ch-ua-mobile":"?0","sec-ch-ua-platform":"\"Linux\"","sec-fetch-dest":"document","sec-fetch-mode":"navigate","sec-fetch-site":"same-origin","upgrade-insecure-requests":"1","user-agent":"Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/124.0.6367.78 Safari/537.36"},"connectTiming":{"requestTime":2217.955254},"clientSecurityState":{"initiatorIsSecureContext":true,"initiatorIPAddressSpace":"Public","privateNetworkRequestPolicy":"Allow"},"siteHasCookieInOtherPartition":false},"sessionId":"A6824EC885E1DECED8249D08EE77ECED"} [] []
[2024-12-11T12:06:24.448758+00:00] chrome.DEBUG: socket(1): ← receiving data:{"method":"Target.targetDestroyed","params":{"targetId":"28CE5B63ADB05D8FAFAE9BD8EAA02009"}} [] []
[2024-12-11T12:06:24.448805+00:00] chrome.DEBUG: socket(1): ← receiving data:{"method":"Network.loadingFailed","params":{"requestId":"6E80EC23A87FD5D918CF3DDA78E66A0D","timestamp":2217.958139,"type":"Document","errorText":"net::ERR_ABORTED","canceled":true},"sessionId":"A6824EC885E1DECED8249D08EE77ECED"} [] []
[2024-12-11T12:06:24.448853+00:00] chrome.DEBUG: socket(1): ← receiving data:{"method":"Target.targetInfoChanged","params":{"targetInfo":{"targetId":"5F07DD38EA0F00D65157FDA91EF50360","type":"page","title":"Download This is Going to Hurt by Adam Kay epub","url":"https://tiny-files.com/59b97e122533b93c2de05c1d/2817096/This%20is%20Going%20to%20Hurt%20by%20Adam%20Kay.epub/","attached":false,"canAccessOpener":false,"browserContextId":"0300CEFA052BF9ECF80F0F88BF7291AF"}}} [] []
[2024-12-11T12:06:24.448978+00:00] chrome.DEBUG: socket(1): ← receiving data:{"method":"Target.detachedFromTarget","params":{"sessionId":"A6824EC885E1DECED8249D08EE77ECED","targetId":"5F07DD38EA0F00D65157FDA91EF50360"}} [] []
[2024-12-11T12:06:24.449737+00:00] chrome.DEBUG: socket(1): ← receiving data:{"method":"Target.targetDestroyed","params":{"targetId":"5F07DD38EA0F00D65157FDA91EF50360"}} [] []
[2024-12-11T12:06:24.450019+00:00] chrome.DEBUG: session(A6824EC885E1DECED8249D08EE77ECED): ⇶ dispatching method:Page.frameStartedLoading [] []
[2024-12-11T12:06:24.450328+00:00] chrome.DEBUG: session(A6824EC885E1DECED8249D08EE77ECED): ⇶ dispatching method:Network.requestWillBeSent [] []
[2024-12-11T12:06:24.451179+00:00] chrome.DEBUG: session(A6824EC885E1DECED8249D08EE77ECED): ⇶ dispatching method:Page.frameClearedScheduledNavigation [] []
[2024-12-11T12:06:24.452204+00:00] chrome.DEBUG: socket(1): disconnecting [] []
[2024-12-11T12:06:24.452442+00:00] chrome.DEBUG: socket(1): ✓ disconnected [] []
[2024-12-11T12:06:24.452499+00:00] chrome.DEBUG: socket(1): disconnecting [] []
[2024-12-11T12:06:24.452578+00:00] chrome.DEBUG: socket(1): ✗ could not disconnect [] []
[2024-12-11T12:06:24.452613+00:00] chrome.DEBUG: process: waiting for process to close [] []
[2024-12-11T12:06:24.472382+00:00] chrome.DEBUG: process: cleaning temporary resources:/tmp/chromium-php-bacONO [] 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant