grunt-contrib-qunit icon indicating copy to clipboard operation
grunt-contrib-qunit copied to clipboard

Blocked by CORS policy

Open davidjbradshaw opened this issue 6 years ago • 5 comments

Trying to upgrade to v3.1, but I am getting the following error:

Access to XMLHttpRequest at 'file:///Users/dave/dev/iframe-resizer/src/iframeResizer.js?_=1550217744050' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https.

I can see this is an issue with the default settings of Chrome, so I added the flags to turn this error off, but that does not appear to be being passed through

puppeteer: {
  args: [
    '--disable-web-security',
    '--allow-file-access-from-files',
    '--user-data-dir=/tmp'
  ]
}

davidjbradshaw avatar Feb 15 '19 08:02 davidjbradshaw

Following config worked for me:

puppeteer: {
	ignoreDefaultArgs: true,
	args: [
		"--headless",
		"--disable-web-security",
		"--allow-file-access-from-files"
	]
},

m-niesluchow avatar Mar 18 '19 15:03 m-niesluchow

@davidjbradshaw Did you get this working? Can this issue be closed?

zachelrath avatar Jul 15 '19 19:07 zachelrath

Ping @m-niesluchow @davidjbradshaw

I am also facing the same issue after upgrading to grunt-contrib-qunit v3.1, I have added the changes you suggested in my Gruntfile.js but issue still persists.

Could you specify exactly where these flags needed to be specified so that issue could get resolved.

ossdev07 avatar Jul 16 '19 13:07 ossdev07

@ossdev07 I am not working anymore on code, but version was "grunt-contrib-qunit": "^3.1.0" and below is part of configuration.

grunt.initConfig({
...
	qunit: {
		options: {
			puppeteer: {
				ignoreDefaultArgs: true,
				args: [
					"--headless",
					"--disable-web-security",
					"--allow-file-access-from-files"
				]
			},
			timeout: 10000
		},
...

m-niesluchow avatar Jul 16 '19 13:07 m-niesluchow

@m-niesluchow Thanks for the solution it worked for me.

ossdev07 avatar Jul 17 '19 13:07 ossdev07