ampproject / amphtml

The AMP web component framework.
https://amp.dev
Apache License 2.0
14.89k stars 3.89k forks source link

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

Closed nikse closed 5 years ago

nikse commented 6 years ago

What's the issue?

Please see thread starting here for discussion with @jridgewell: https://github.com/ampproject/amphtml/issues/16052#issuecomment-426366677

Amp-ad type="doubleclick" fails to render because it is already collapsed.

How do we reproduce the issue?

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

What browsers are affected?

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)

@lannka

nikse commented 6 years ago

posting last comment from @jridgewell here for @lannka

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?

RonanDrouglazet commented 6 years ago

Hi all,

same here for one of our publisher https://calcio.fanpage.it/amichevole-italia-ucraina-le-ultime-sulle-formazioni-le-quote-e-dove-vederla-in-tv/amp/?google_preview=VR1kgoPGP1MYh5_33QUwh7us5QWIAYCAgKDb8MT0SQ&iu=1010633&gdfp_req=1&lineItemId=4816432979&creativeId=138246844693

capture d ecran 2018-10-18 a 16 34 49 capture d ecran 2018-10-18 a 16 42 45

Thanks for your help AMP Team !

calebcordry commented 6 years ago

I have created a minimal reproducible example for this error message here. https://gist.github.com/calebcordry/c0bb284a50d176844d0c20050eb4b92c

However in this example, the error throws, but the ad is still rendering. Still investigating what is causing the ad not to render in the above examples

calebcordry commented 6 years ago

Did some more digging, and read through the previous thread. My hypothesis is that this error and whatever may be causing these ads not to show are not related.

I am able to reproduce the error, but the ad will still render.

I also checked that the isCollapsed flag should === true when a no-fill is returned. This is working-as-intended.

@nikse It sounds like maybe you are getting no-fills when you expect there to be fills. That is a separate issue. You can verify a correct no fill with a 200 response containing the amp-ff-empty-creative: true header.

@RonanDrouglazet @nikse Feel free to let me know if you think I have overlooked anything. Thanks.

RonanDrouglazet commented 6 years ago

Thanks @calebcordry for your time !

The issue for me is => when the error is thrown, the entry point for SafeFrame framework does not exist as it should in the amp-ad type="doubleclick" iframe window (window.$sf). We should be able to use window.$sf.ext (SafeFrame API) but didn't exist due to this error I think

capture d ecran 2018-10-23 a 11 45 14

So seems to be related to the doubleclick component cf https://github.com/ampproject/amphtml/blob/master/extensions/amp-ad-network-doubleclick-impl/safeframe.md

Due to the "non-existing" SF entry point, the ad does not understand they are in a AMP SafeFrame context (and can't ask for an opening too)

nikse commented 6 years ago

Hey sorry, just catching up here. We are seeing our ads render now, it actually turns out someone changed the targeting on our ads to an invalid value which was blocking the rendering of all our ads. We are still seeing this error though, so I am curious as to what the issue is

Thanks

calebcordry commented 6 years ago

@nikse the error comes from out document register element patch. It seems like it was explained a bit in the previous thread, but should not be affecting your use case.

@RonanDrouglazet Could you please open a separate issue around the safeframe problem and mention me? I don't want to confuse it with the original issue here, and I will make sure it gets routed appropriately. Thanks!

nikse commented 6 years ago

thanks for the update!

calebcordry commented 5 years ago

It appears this issue is solved. Following up on $sf in the other issues.

Hammad6264 commented 5 years ago

Hy, Did anyone solved the problem???

ahmadalfy commented 5 years ago

I am seeing the same issue with Amp-ad type="doubleclick" as well. Using Chrome 75.0.3759.4 (Official Build) dev (64-bit)

jridgewell commented 5 years ago

Hi all,

This is a duplicate of #16052. Please see https://github.com/ampproject/amphtml/issues/16052#issuecomment-426386111, in particular. While this appears as an error, it it totally harmless and can be ignored. We're working on this.