question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Are aborted requests able to set cookies?

See original GitHub issue

I am using Playwright Python as part of my own SaaS product to inspect web pages. On the following URL a Youtube video is embedded, and the consent management software Usercentrics is in place to block loading the video until the user has given their consent:

https://www.phoenix-mecano.ch/de/produkte/fahrerlose-transportsysteme-fts/fahrerlose-transportsysteme-fts.html/779

Usercentrics aborts the network request to Youtube using some JS code. When loading this page in a “real” Chrome browser and watching the devtools network tab, the reqest is sometimes highlighted in red with the status “aborted”. The request does in no case set any cookies.

When loading the page with Playwright, one can detect that the request is aborted in 100% of all test runs (see the example code). However, in about 50% of the test runs I do, I can see multiple cookies from the domain youtube.com. There is no other request to Youtube, so apparently this aborted request manages to set cookies. How is this possible, this seems to me like a bug in Playwright? Wether cookies are set or not is a crucial result in my (data protection related) SaaS product.

import asyncio
from playwright.async_api import async_playwright
from random import randrange

async def main():
	async with async_playwright() as p:
		for browser_type in [p.chromium]:
			browser = await browser_type.launch()
			page = await browser.new_page()
			page.on("requestfailed", lambda request: print("request failed",request.url,request.failure))
			await page.goto(url='https://www.phoenix-mecano.ch/de/produkte/fahrerlose-transportsysteme-fts/fahrerlose-transportsysteme-fts.html/779',wait_until = 'networkidle')
			cookies = await page.context.cookies()
			for cookie in cookies:
				print("cookie",cookie['name'],cookie['domain'])
			await browser.close()
asyncio.get_event_loop().run_until_complete(main())

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
eckhardscommented, Dec 13, 2021

Hey @dgozman , I was unable to produce a repro that reliably shows the effect. I presume this is some race conditions related thing going on. We might close this ticket because it is not repdoducible, in case I find a repro I will open a new ticket. Thanks so far!

0reactions
eckhardscommented, Dec 12, 2021

@dgozman I fully understand - tried to make it reproducable with a trace but with no avail, even though the effect still persists when using a Chrome on my Macbook. I will keep trying to set up a repro and will follow up. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

csrf verification failed. request aborted, CSRF cookies not set ...
I am trying to fetch one POST request from javaScript file without any HTML form to my Django endpoint but it is giving...
Read more >
AbortController.abort() - Web APIs | MDN
The abort() method of the AbortController interface aborts a DOM request before it has completed. This is able to abort fetch requests, ...
Read more >
Troubleshooting requests - Postman Learning Center
To find out what the problem is, you can use the Postman Console to troubleshoot your request. This guide also lists common issues...
Read more >
Request and response behavior for Amazon S3 origins
Amazon S3 doesn't process cookies. If you configure a cache behavior to forward cookies to an Amazon S3 origin, CloudFront forwards the cookies,...
Read more >
Michigan Supreme Court asked to OK ballot question on ...
Abortion -rights supporters say it's important for state residents to be able to weigh in on the abortion question, especially because of a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found