Next.js: next fails in safari iframe

Created on 17 Oct 2017  路  5Comments  路  Source: vercel/next.js

next version: 4.1.0

When we load our nextjs app in an iframe we get an error at the following line and our component doesn't respond to input.

replaceState@[native code] changeState@http://localhost:8081/_next/1508243766275/main.js:8667:33 Router@http://localhost:8081/_next/1508243766275/main.js:8298:23 Router@[native code] createRouter@http://localhost:8081/_next/1508243766275/main.js:1055:102 _callee$@http://localhost:8081/_next/1508243766275/main.js:18220:63 tryCatch@http://localhost:8081/_next/1508243766275/main.js:7005:44 invoke@http://localhost:8081/_next/1508243766275/main.js:7239:30 step@http://localhost:8081/_next/1508243766275/main.js:1823:30 http://localhost:8081/_next/1508243766275/main.js:1834:17 promiseReactionJob@[native code]

https://github.com/zeit/next.js/blob/c6bd6ef9973b935df116eaafec1cd57555aa1b93/lib/router/router.js#L188

Most helpful comment

I鈥檓 getting a similar error in Chrome/Firefox when I run my Next.js app inside an IFrame (works great outside the IFrame):

Failed to execute 'replaceState' on 'History': A history state object with URL 'http://localhost:3000/' cannot be created in a document with origin 'http://localhost:8000' and URL 'http://localhost:8000/'.
Error: Failed to execute 'replaceState' on 'History': A history state object with URL 'http://localhost:3000/' cannot be created in a document with origin 'http://localhost:8000' and URL 'http://localhost:8000/'

From what I can tell, it鈥檚 this line that鈥檚 crashing:

https://github.com/zeit/next.js/blob/master/lib/router/router.js#L188

@philipheinser is this similar to your issue?

Any clues on how to solve?

All 5 comments

I鈥檓 getting a similar error in Chrome/Firefox when I run my Next.js app inside an IFrame (works great outside the IFrame):

Failed to execute 'replaceState' on 'History': A history state object with URL 'http://localhost:3000/' cannot be created in a document with origin 'http://localhost:8000' and URL 'http://localhost:8000/'.
Error: Failed to execute 'replaceState' on 'History': A history state object with URL 'http://localhost:3000/' cannot be created in a document with origin 'http://localhost:8000' and URL 'http://localhost:8000/'

From what I can tell, it鈥檚 this line that鈥檚 crashing:

https://github.com/zeit/next.js/blob/master/lib/router/router.js#L188

@philipheinser is this similar to your issue?

Any clues on how to solve?

This has been fixed in Next 5+ if i remember correctly.

I鈥檓 seeing this issue still in Next.js 7.0.2, wasn鈥檛 this patched in #3437?

@timneutkens, do you know if #3437 was patched in?

Failed to execute 'replaceState' on 'History': A history state object with URL 'https://MYSERVER1/page' cannot be created in a document with origin 'https://MYSERVER2.com' and URL 'https://MYSERVER2.com/page'.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timneutkens picture timneutkens  路  3Comments

formula349 picture formula349  路  3Comments

knipferrc picture knipferrc  路  3Comments

ghost picture ghost  路  3Comments

rauchg picture rauchg  路  3Comments