-
Notifications
You must be signed in to change notification settings - Fork 4.1k
amp-analytics in shadow AMP broken #5565
Description
Including <amp-analytics> extension in a shadow AMP causes an error that looks like this:
Uncaught Error: No ampdoc found for [object HTMLDocument]
This starts in mergeShadowHead when attaching the shadow doc -- the extension is attached to the window's document rather than the shadow root document. Activity fails to construct when trying to grab a couple services off the AmpDocument, and getAmpDoc understandably fails to locate the shadow root.
It seems that the extensions need to be installed with a reference to the shadow document, though I'm not sure if something is in progress already.
@dvoytenko You're probably aware of this already. What do you think is the best way to fix this?
Full trace:
createErrorVargs @ log.js:384
createError @ log.js:199
getAmpDoc @ ampdoc-impl.js:152
v @ service.js:275
A @ service.js:72
Ia @ viewer.js:24
da @ service.js:332
w @ service.js:114
(anonymous function) @ service.js:112
f @ amp-analytics.js:35
registerExtension_ @ extensions-impl.js:199
registerExtension @ extensions-impl.js:103
installExtension @ runtime.js:249
(anonymous function) @ runtime.js:270
waitForChild @ dom.js:41
waitForBody @ dom.js:75
global.AMP.push @ runtime.js:269
(anonymous function) @ amp-analytics-0.1.js:1