Skip to content

DOMException: Failed to execute 'replaceState' on 'History': A history state object with URL #24

@harsimerkaur

Description

@harsimerkaur

Issue Title

web page does not open when viewed in google cached option.

Expected Behavior

Should work in a similar way in google web cache as working when directly opened.

Current Behavior

After implementing SSR as described in the documentation, app works fine, but when viewed with google cached option I get:

vendor.72c7865b.chunk.js:2 DOMException: Failed to execute 'replaceState' on 'History': A history state object with URL 'https://mywebsite.com/' cannot be created in a document with origin 'http://webcache.googleusercontent.com' and URL 'http://webcache.googleusercontent.com/search?q=cache:X4dz2ukZZAYJ:https://mywebsite.com/&hl=en&gl=in&strip=0&vwsrc=0'.
at History.b. [as replaceState] (https://connect.facebook.net/en_US/fbevents.js:25:31098)
at https://ssr-static.mywebsite.com/v19.7.7-1810-gab2a29c95/static/vendor.72c7865b.chunk.js:2:23763
at Object.confirmTransitionTo (https://ssr-static.mywebsite.com/v19.7.7-1810-gab2a29c95/static/vendor.72c7865b.chunk.js:2:21254)
at Object.replace (https://ssr-static.mywebsite.com/v19.7.7-1810-gab2a29c95/static/vendor.72c7865b.chunk.js:2:23671)
at render (https://ssr-static.mywebsite.com/v19.7.7-1810-gab2a29c95/static/rootcomp.1fc87201.chunk.js:1:1466)
at https://ssr-static.mywebsite.com/v19.7.7-1810-gab2a29c95/static/vendor.72c7865b.chunk.js:2:4947
at vu (https://ssr-static.mywebsite.com/v19.7.7-1810-gab2a29c95/static/vendor.72c7865b.chunk.js:2:142881)
at cl (https://ssr-static.mywebsite.com/v19.7.7-1810-gab2a29c95/static/vendor.72c7865b.chunk.js:2:132015)
at ul (https://ssr-static.mywebsite.com/v19.7.7-1810-gab2a29c95/static/vendor.72c7865b.chunk.js:2:131940)
at Zu (https://ssr-static.mywebsite.com/v19.7.7-1810-gab2a29c95/static/vendor.72c7865b.chunk.js:2:128970)

Possible Solution

Is this related to CORS? because when I open web app in google chrome with disabled security then it opens the webpage correctly with cached option.

Steps to Reproduce

Search react router in google chrome, open cached option, check console.
It shows same error.
Screen Shot 2020-07-29 at 1 54 56 AM

Context (Environment)

react-loadable-ssr-addon: "0.2.0"
history: "^4.10.1",
react-router-dom: "^5.1.2"

Environment

  1. OS running:
  2. Node version:
  3. Webpack version:

Detailed Description

Possible Implementation

Other Comments

This issue might be related Failed to execute 'replaceState' on 'History'

Metadata

Metadata

Assignees

No one assigned

    Labels

    investigationThis issue needs an investigation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions