Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚨 Error: Cannot read property 'setAttribute' of null #27748

Closed
ampprojectbot opened this issue Apr 14, 2020 · 4 comments
Closed

🚨 Error: Cannot read property 'setAttribute' of null #27748

ampprojectbot opened this issue Apr 14, 2020 · 4 comments
Labels
P2: Soon Type: Error Report An error reported by AMP Error Reporting WG: runtime

Comments

@ampprojectbot
Copy link
Member

Details

Error report: link
First seen: Oct 17, 2019
Frequency: ~ 8114/day

Stacktrace

Error: Cannot read property 'setAttribute' of null
    at setAttribute (https://raw.githubusercontent.com/ampproject/amphtml/2004012158290/src/service/extensions-impl.js:258)
    at reloadExtension (https://raw.githubusercontent.com/ampproject/amphtml/2004012158290/src/runtime.js:472)
    at maybeLoadCorrectVersion (https://raw.githubusercontent.com/ampproject/amphtml/2004012158290/src/runtime.js:241)
    at (https://raw.githubusercontent.com/ampproject/amphtml/2004012158290/src/service/timer-impl.js:83)

@choumx modified src/service/extensions-impl.js:258-259 in #24730 (Oct 1, 2019)
@jridgewell modified src/runtime.js:472-472 in #24402 (Sep 6, 2019)
@cramforce modified src/service/timer-impl.js:81-88 in #7363 (Feb 7, 2017)

Potential assignees: @choumx, @jridgewell

@ampprojectbot ampprojectbot added the Type: Error Report An error reported by AMP Error Reporting label Apr 14, 2020
@rcebulko
Copy link
Contributor

It looks like this error started surfacing a short while after #24730 was merged. There is a devAssert() to verify that the el exists with the warning 'Cannot find script for extension: %s', extensionId. It looks like this happens when an extension <script> tag is missing.

@choumx Am I correct that this should only be possible on non-valid AMPs? It seems maybe this should raise a user().error() explicitly and bail out before trying to set attributes on the element. If that's the case, I'm happy to throw together a PR with this fix

@rcebulko
Copy link
Contributor

I'll add that the volume of this error was pretty low until recently, but it seems most of the recent referrers are AliExpress, indicating they probably have this (mis)?configuration on one of their pages, which brought this error to the front page.

@dreamofabear
Copy link

Somewhat confusing. It appears that this would happen if an extension is added to preregisteredExtensions but the extension script is missing. Need to look at a repro page to pinpoint the issue.

@dreamofabear
Copy link

#29042 should fix this too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2: Soon Type: Error Report An error reported by AMP Error Reporting WG: runtime
Projects
None yet
Development

No branches or pull requests

4 participants