AxaFrance / oidc-client

Light, Secure, Pure Javascript OIDC (Open ID Connect) Client. We provide also a REACT wrapper (compatible NextJS, etc.).
MIT License
597 stars 160 forks source link

Storage object could not be cloned. #911

Closed Zhuohui-Li closed 1 year ago

Zhuohui-Li commented 1 year ago

Issue and Steps to Reproduce

copy the ServiceWorker.js from oidc/vanilla/OidcServiceWorker.js to ./public and then run

index.js:1 DOMException: Failed to execute 'postMessage' on 'ServiceWorker': Storage object could not be cloned.
    at http://localhost:3000/static/js/vendors~main.chunk.js:505176:27
    at new Promise (<anonymous>)
    at http://localhost:3000/static/js/vendors~main.chunk.js:505165:12
    at _callee3$ (http://localhost:3000/static/js/vendors~main.chunk.js:505363:62)
    at tryCatch (http://localhost:3000/static/js/vendors~main.chunk.js:527455:17)
    at Generator.<anonymous> (http://localhost:3000/static/js/vendors~main.chunk.js:527536:22)
    at Generator.next (http://localhost:3000/static/js/vendors~main.chunk.js:527480:21)
    at http://localhost:3000/static/js/vendors~main.chunk.js:504934:67
    at new Promise (<anonymous>)
    at push.../../node_modules/@axa-fr/react-oidc/dist/vanilla/initWorker.js.__awaiter (http://localhost:3000/static/js/vendors~main.chunk.js:504913:10)
    at Object.initAsync (http://localhost:3000/static/js/vendors~main.chunk.js:505356:22)
    at Oidc._callee14$ (http://localhost:3000/static/js/vendors~main.chunk.js:506711:50)
    at tryCatch (http://localhost:3000/static/js/vendors~main.chunk.js:527455:17)
    at Generator.<anonymous> (http://localhost:3000/static/js/vendors~main.chunk.js:527536:22)
    at Generator.next (http://localhost:3000/static/js/vendors~main.chunk.js:527480:21)
    at fulfilled (http://localhost:3000/static/js/vendors~main.chunk.js:505682:24)

Versions

6.10.20

Screenshots

image

Expected

no errors

Actual

throwing a DOMException error

Additional Details

guillaume-chervet commented 1 year ago

Hi @Zhuohui-Li , thank you for your issue. What does look like your configuration?

guillaume-chervet commented 1 year ago

I think the issue is Linked to https://github.com/AxaGuilDEv/react-oidc/issues/910

You may temporary comment storage mode. I will try to fix it tomorrow.

Zhuohui-Li commented 1 year ago

Hi @guillaume-chervet The configuration is

client_id: 
    redirect_uri:
    scope: 
    authority: 
    refresh_time_before_tokens_expiration_in_second: 10,
    service_worker_relative_url: `/OidcServiceWorker.js`,
    service_worker_only: false, 
    storage: localStorage,
    authority_configuration: {

    },
  },
guillaume-chervet commented 1 year ago

Thank you @Zhuohui-Li , you need to comment storage line in your configuration. If it does not work you can downgrade to an previous version. I will fix this tomorrow. Very sorry for that bug @Zhuohui-Li

guillaume-chervet commented 1 year ago

Which browser are you using? @Zhuohui-Li

Zhuohui-Li commented 1 year ago

Which browser are you using? @Zhuohui-Li

Chrome Version 107.0.5304.121 on M1 MacBook

guillaume-chervet commented 1 year ago

hi @Zhuohui-Li ,

Version 6.10.21 fix this issue: https://github.com/AxaGuilDEv/react-oidc/commit/1b1cfd58b6dd88968e68175e20435854b34acba1 I'am very sorry for the delay, thank you very much for your help :)

guillaume-chervet commented 1 year ago

Hi @Zhuohui-Li , i think the error is fixed now. May we close the issue?

Zhuohui-Li commented 1 year ago

Hi @guillaume-chervet Thanks a lot. I closed the issue