amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-ad-network-doubleclick Cannot read property 'map' of undefined

Open muxin opened this issue 9 years ago • 9 comments

TypeError: Cannot read property 'map' of undefined
    at https://cdn.ampproject.org/rtv/001482359659944/v0/amp-ad-network-doubleclick-impl-0.1.js:78:221

muxin avatar Jan 04 '17 22:01 muxin

Not sure who to send to. @keithwrightbos ?

muxin avatar Jan 04 '17 22:01 muxin

This is because https://github.com/ampproject/amphtml/blob/ec703a549a0c1fc024100150f2738fabe2779c66/extensions/amp-a4a/0.1/amp-a4a.js#L874 and https://github.com/ampproject/amphtml/blob/ec703a549a0c1fc024100150f2738fabe2779c66/extensions/amp-a4a/0.1/amp-a4a.js#L866 return an object without a keys array.

jridgewell avatar Jan 04 '17 23:01 jridgewell

Will look into it. Thanks

On Wed, Jan 4, 2017, 6:10 PM Justin Ridgewell [email protected] wrote:

Assigned #6875 https://github.com/ampproject/amphtml/issues/6875 to @keithwrightbos https://github.com/keithwrightbos.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/ampproject/amphtml/issues/6875#event-911943709, or mute the thread https://github.com/notifications/unsubscribe-auth/ABr0LxbLrmse1Y7zgk7QRdMghyWGjHgPks5rPCbogaJpZM4LbJH5 .

keithwrightbos avatar Jan 04 '17 23:01 keithwrightbos

Okay, I see the issues that @jridgewell is pointing to and I can probably do a quick fix. But I'd also like to add tests around it. @muxin : How was this triggered? Do you have some code that reproduces?

tdrl avatar Jan 05 '17 13:01 tdrl

Issue occurs if fetchJson to get the crypto public keys fails (likely due to network error). We should create a test verifying this behavior and fix by ensuring default object returned in catch includes empty keys array. Thanks @tdrl for taking lead!

keithwrightbos avatar Jan 05 '17 13:01 keithwrightbos

I cannot reproduce it by following the link that reported the error, but the error happens every now and then since last canary release (1482359659944). Also saw error logs:

TypeError: Cannot read property 'map' of undefined
    at https://cdn.ampproject.org/rtv/001482359659944/v0/amp-ad-network-adsense-impl-0.1.js:78:221

muxin avatar Jan 05 '17 17:01 muxin

When one small fix turns into a refactor and a new test suite...

This is taking longer than hoped. (On the plus side, it's uncovering some edges that we hadn't tested well, so is pushing us to improve. Yay?)

I hope you're not blocking a canary or release on this. It's a low-threat failure case in the wild b/c even when network errors occur, the key request gets re-issued later so there's a chance for recovery.

tdrl avatar Jan 05 '17 21:01 tdrl

Thanks for looking into it. We're not blocking the release on this.

muxin avatar Jan 06 '17 00:01 muxin

The fix will go into next canary release (current canary doesn't include this).

muxin avatar Jan 10 '17 22:01 muxin