Elius94 / react-photo-sphere-viewer

Photosphere Viewer for React.JS
MIT License
65 stars 21 forks source link

Getting CORS Error #50

Closed raoehtesham03 closed 8 months ago

raoehtesham03 commented 8 months ago

What happened?

When I am trying to open ReactPhotoSphereViewer and starts loading the image it gives CORS error.

What should have happened?

It should have rendered the image without giving any error.

Code

Access to fetch at 'https://example.com/2354534534534' from origin 'https://example2.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Sandbox Link

No response

Library Version

react-photo-sphere-viewer :- 4.2.1-psv5.6.0

What operating system are you using?

macOS

What browser are you using?

Chrome

Logs

TypeError: Failed to fetch at n.value (three.module.js:34349:1) at index.module.js:9192:1 at new Promise () at n.value (index.module.js:9188:1) at n. (index.module.js:3947:1) at u (index.module.js:52:1) at Generator. (index.module.js:150:1) at Generator.next (index.module.js:83:1) at BP (index.module.js:364:1) at o (index.module.js:386:9) o @ index.module.js:9773 (anonymous) @ index.module.js:9828 Promise.then (async) value @ index.module.js:9825 n @ index.module.js:9522 (anonymous) @ index.js:144 uu @ react-dom.production.min.js:5142 Ss @ react-dom.production.min.js:6494 t.unstable_runWithPriority @ scheduler.production.min.js:309 Yo @ react-dom.production.min.js:2816 Es @ react-dom.production.min.js:6474 ls @ react-dom.production.min.js:5870 (anonymous) @ react-dom.production.min.js:2851 t.unstable_runWithPriority @ scheduler.production.min.js:309 Yo @ react-dom.production.min.js:2816 Ko @ react-dom.production.min.js:2846 Qo @ react-dom.production.min.js:2836 (anonymous) @ react-dom.production.min.js:5910 L @ react-dom.production.min.js:7270 (anonymous) @ react-dom.production.min.js:1323 Show 19 more frames Show less three.module.js:34349

   Uncaught (in promise) TypeError: Failed to fetch
at n.value (three.module.js:34349:1)
at index.module.js:9192:1
at new Promise (<anonymous>)
at n.value (index.module.js:9188:1)
at n.<anonymous> (index.module.js:3947:1)
at u (index.module.js:52:1)
at Generator.<anonymous> (index.module.js:150:1)
at Generator.next (index.module.js:83:1)
at BP (index.module.js:364:1)
at o (index.module.js:386:9)

Interest to fix the bug

Elius94 commented 8 months ago

Hey! this should be fixed in your application! it depends on the server. if you want to use an external image source you have to allow CORS origin! It's not related to this library :) Let me know :)

raoehtesham03 commented 8 months ago

@Elius94 , I believe that when the image loads and saves to the cache, it does not store with the correct permissions. This is why, when the image loads again and attempts to fetch the image URL from the cache memory, resulting in a CORS error.