amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Error: "Cannot read property 'create' of undefined"

Open keithwrightbos opened this issue 8 years ago • 12 comments

Steps to reproduce:

  • emulate mobile and go to page that include amp-ad fast fetch network that returns AMP creative which is preferentially rendered (e.g. https://m-wikihow-com.cdn.ampproject.org/v/s/m.wikihow.com/Delete-Messages-on-Facebook-Messenger?amp=1&amp_js_v=0.1)
  • console log will report the following error although there does not appear to be a breakage in terms of creative interaction (can still click and relevant pings fire).

Uncaught TypeError: Cannot read property 'create' of undefined at new tj (v0.js:42) at new Af (document-register-element.node.js:294) at document-register-element.node.js:284 at Wb (document-register-element.node.js:291) at Ql (amp-img.js:152) at Il.f.installExtensionsInChildWindow (vsync-impl.js:438) at friendly-iframe-embed.js:209

keithwrightbos avatar Jun 14 '18 20:06 keithwrightbos

Not sure I'm the best person for this issue given its likely a low-level AMP core problem and perhaps related to https://github.com/ampproject/amphtml/issues/15759?

keithwrightbos avatar Jun 15 '18 13:06 keithwrightbos

same problem

dev-drprasad avatar Jun 26 '18 05:06 dev-drprasad

This is due to re-entrantcy. We're calling installCustomElements(childWin), but it's evaluating in the parent window's JS context, not childWin's. This redefines some data structures, but we've already installed the polyfill in the parent window. When it tries to re-run its tests, it ends up getting caught in this bug.

jridgewell avatar Jul 18 '18 00:07 jridgewell

I'm still seeing this issue constantly in a lot of my articles. could it be affecting ad views?

urls: https://www.inverse.com/amp/article/49479-why-do-elephants-have-wrinkled-cracked-skin https://www.google.com/amp/s/www.inverse.com/amp/article/49479-why-do-elephants-have-wrinkled-cracked-skin

screen shot 2018-10-02 at 1 42 40 pm

nikse avatar Oct 02 '18 17:10 nikse

@nikse: It won't affect views. The error in this case is because a polyfill is trying to re-polyfill, so when it fails it continues to be ok.

jridgewell avatar Oct 02 '18 17:10 jridgewell

Interesting, thanks for the quick response. We've actually noticed an ad fill issue since early september and are digging in to everything we can to see what the issue could possibly be, which led me here. Unfortunately it is proving to be extremely difficult to figure out what is happening. I've tried manually looking at the ad responses but can't see anything. Any advice? Thought this issue might be causing some problems, but I guess not

And by ad fill I mean that our ads just aren't rendering/filling even though we have them set to fill at a very low floor and show 100% of the time. I am noticing when this happens that the iframe isn't even rendered in the div, which also led me to investigate this error further

nikse avatar Oct 02 '18 17:10 nikse

Do you have a reproduction page? I'm not able to look into why ads don't fill, but I can investigate up to the point where AMP decides to inject the iframe. After that, it's up to the bidding process and normal 3p ads code.

jridgewell avatar Oct 02 '18 17:10 jridgewell

Awesome thank you! It really seems to be happening on any of our amp article pages, like this one

direct link: https://www.inverse.com/amp/article/49498-kyrie-irving-flat-earth-apology-education google cache link: https://www.google.com/amp/s/www.inverse.com/amp/article/49498-kyrie-irving-flat-earth-apology-education

nikse avatar Oct 02 '18 18:10 nikse

Chrome? Safari? iOS?

jridgewell avatar Oct 02 '18 18:10 jridgewell

sorry about that. i am seeing this in chrome, either emulating an iphone or just loading up the non google cache link in desktop mode

Google Chrome is up to date Version 69.0.3497.100 (Official Build) (64-bit)

nikse avatar Oct 02 '18 18:10 nikse

Ok, so layoutCallback is being called appropriately. But, when it tries to render the iframe, it's apparently already isCollapsed. Can you file a new issue and tag @lannka?

jridgewell avatar Oct 02 '18 18:10 jridgewell

yup! thanks a lot

nikse avatar Oct 02 '18 18:10 nikse