3box / 3box-js

3Box JavaScript SDK: User identities, storage, messaging
MIT License
207 stars 65 forks source link

Replicate Chrome CORS issue #240

Closed michaelsena closed 5 years ago

michaelsena commented 5 years ago

Reported by Totem, and others

oed commented 5 years ago

I can't seem to replicate this error with chrome on macos. @zachferland did you have any more info on this?

0nlyP2P commented 5 years ago

I had this issue when accessing https://3box.io within an iframe from https://localhost:8080 Then I cloned the 3box/3box-dapp repo and served it over http://localhost:3000, this worked.

I started chrome on linux (Ubuntu 18.04) with the flag --allow-insecure-localhost

I switched to linux a year ago and changed many settings in chrome and in ubuntu too.

A reinstall helped me fixing this issue, now everything works fine with --allow-insecure-localhost and https://localhost:8080.

oed commented 5 years ago

@wagner-daniel Alright! That seems like another issue then what we where looking to capture here. Basically I thought that there was a CORS issue with using the 3box-js library when your dapp ran on localhost. But you haven't experienced that right?

0nlyP2P commented 5 years ago

No, 3box.js worked fine. I only used the version from unpkg so far. Not the npm package.

marc4gov commented 5 years ago

Also having issues with CORS on localhost using npm package

schermafbeelding 2019-01-09 om 13 34 08
c-castillo commented 5 years ago

@marc4gov are you using chrome or other browser? (like Brave, for example)

0nlyP2P commented 5 years ago

Have you tried calling the fetch method like this: fetch(url, {mode: 'no-cors'});

marc4gov commented 5 years ago

This was Brave but also on Chrome, same issue. I just use the 3box-js npm package, so not using fetch... Do you have an working example?

0nlyP2P commented 5 years ago

The 3box-js package calls fetch without this option.

@marc4gov have you tried it from another domain than localhost? Maybe setting allow-insecure-localhost in chrome flags can fix it.

oed commented 5 years ago

@marc4gov I'm also unable to reproduce your issue in Chrome (MacOS).

@wagner-daniel I'm not sure mode: 'no-cors'} would solve it. These errors are usually caused by the browser blocking the request: https://developer.mozilla.org/en-US/docs/Web/API/Request/mode

c-castillo commented 5 years ago

@marc4gov I wasn't able to reproduce it either. Some additional questions:

Thanks for the feedback already!

marc4gov commented 5 years ago

@c-castillo I tried incognito mode on Chrome, but same issue. I just recloned the 3box-js repo did an npm install and started the example like this:

Marc:3box-js marc$ npm run example:start

> 3box@1.2.0-beta.6 example:start /Users/marc/3box-js
> npm run build:dist; node example/server.js

> 3box@1.2.0-beta.6 build:dist /Users/marc/3box-js
> webpack --config webpack.config.js --mode=development

Hash: ac0252b66cfd0b366d89
Version: webpack 4.20.2
Time: 8830ms
Built at: 2019-01-10 14:32:56
  Asset      Size  Chunks             Chunk Names
3box.js  13.5 MiB    main  [emitted]  main
Entrypoint main = 3box.js
 [./src/keyValueStore.js] 9.01 KiB {main} [built]
 [1] crypto (ignored) 15 bytes {main} [optional] [built]
 [./node_modules/webpack/buildin/amd-options.js] (webpack)/buildin/amd-options.js 82 bytes {main} [built]
 [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 509 bytes {main} [built]
 [./src/3box.js] 41.9 KiB {main} [built]
 [2] xmlhttprequest (ignored) 15 bytes {main} [built]
 [6] crypto (ignored) 15 bytes {main} [built]
[20] fs (ignored) 15 bytes {main} [built]
[21] xmlhttprequest (ignored) 15 bytes {main} [built]
 [./src/orbitdbKeyAdapter.js] 1.87 KiB {main} [built]
 [./src/privateStore.js] 6.21 KiB {main} [built]
 [./src/publicStore.js] 3.33 KiB {main} [built]
 [./src/utils/index.js] 3.63 KiB {main} [built]
 [./src/utils/verifier.js] 5.11 KiB {main} [built]
 [./src/verified.js] 7.57 KiB {main} [built]
    + 2914 hidden modules
Open http://localhost:30000 in a browser to start using the example
c-castillo commented 5 years ago

Hi @marc4gov we have fixed our graphql service. Let us know if you still can't make it work to reopen this issue.

marc4gov commented 5 years ago

Yeah, seems to work now. Strange things happen though with rinkeby, accounts with no 3box profile are still giving CORS issue, you would expect a different error message

oed commented 5 years ago

Thanks @marc4gov Opened a new issue here: https://github.com/3box/3box-graphql/issues/20