amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-ad call fails to fire if type is forced to fixed

Open nibuca opened this issue 7 years ago • 7 comments

What's the issue?

We've run into an issue with ads in AMP failing.

In investigating this it looks like this is happening because the ads are set to type="responsive". The console reports "4log.js:187 Behavior of multi-size and responsive layout is currently not well defined. Forcefully overriding layout to fixed." So it looks like it knows that it should be using "fixed" but the forced overriding doesn't appear to be working. When I manually update the type to "fixed" the ads shows up.

Later in the console I see this: error.js:227 Uncaught (in promise) Error: CANCELLED at error.js:227 at amp-ad-network-doubleclick-impl.js:589

How do we reproduce the issue?

Visit the test url here: http://rev.cbsi.com/common/test/AMP/cbsnews-nottracking.amp.html There are 6 ads in the page but only two making ad calls and displaying.

What browsers are affected?

I've only tested this in Chrome.

Which AMP version is affected?

I do not know. It's not working now with the current version.

nibuca avatar Dec 12 '18 19:12 nibuca

Investigating

bradfrizzell avatar Dec 12 '18 19:12 bradfrizzell

FYI: The change that forces fixed layout on multi-size slots went live sometime in August. Here's the PR for it. If nothing about the slot configuration changed since then, it's likely unrelated to the issue here.

glevitzky avatar Dec 12 '18 19:12 glevitzky

I have not yet done a data analysis to find out how long this issue has been happening. I'll check with a Product Manager to see if they have any data.

nibuca avatar Dec 12 '18 20:12 nibuca

Disregard my previous message, it looks like forcing the layout change is indeed the cause here.

glevitzky avatar Dec 12 '18 20:12 glevitzky

@glevitzky looking through the numbers, the issue begun in August, but we did not realize it was that massive until now

shimonenator avatar Dec 12 '18 21:12 shimonenator

@jridgewell @lannka @keithwrightbos

I can fix this issue by undoing the changes in #19848, but I don't know whether that will reintroduce issue https://github.com/ampproject/amphtml/issues/16955 (can't manually reproduce, so that's a good sign).

The underlying issue here is that changing the layout attribute on the slot appears to somehow trigger unlayoutCallback, which invalidates our ad promise, causing no request to be issued. Is this expected behavior from the runtime? If not, perhaps the fix should be there.

You can confirm this easily by commenting out this line: https://github.com/ampproject/amphtml/blob/master/extensions/amp-ad-network-doubleclick-impl/0.1/amp-ad-network-doubleclick-impl.js#L528, then proxying the repro page on this issue and observing that all ads load fine. Uncommenting that line, you'll see that unlayoutCallback is called after we initiate the ad request, causing the issue outlined in my second paragraph.

I'm not sure how to proceed, so any feedback would be useful.

glevitzky avatar Dec 12 '18 22:12 glevitzky

Spoke with @jridgewell offline, sounds like the best path forward is to avoid changing the layout attribute.

glevitzky avatar Dec 12 '18 22:12 glevitzky