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: null is not an object (evaluating 'a.getElementsByTagName') #116

Open
ampprojectbot opened this issue Dec 14, 2021 · 1 comment

Comments

@ampprojectbot
Copy link
Member

Details

Error report: link
First seen: Mar 14, 2021
Frequency: ~ 6,648/day

Stacktrace

Error: null is not an object (evaluating 'a.getElementsByTagName')
    at getElementsByTagName (extensions/amp-live-list/0.1/live-list-manager.js:187:8)

Notes

@rsimha modified extensions/amp-live-list/0.1/live-list-manager.js:187-188 in #21212 (May 16, 2019)

Seen in:

  • 11-24 Control (2025+1)
  • 11-24 Nightly-Control (2025+1)
  • 11-24 Stable (2025+1)

/cc @ampproject/release-on-duty

@rcebulko
Copy link
Collaborator

This error occurs in getLiveLists_(doc) when doc == null. This is called only by updateLiveLists_(doc), which in turn is called only in a .then( callback after fetchDocument (see https://github.com/ampproject/amphtml/blame/711d5de27696965cdfb1d9a6899a6ac146134410/extensions/amp-live-list/0.1/live-list-manager.js#L148). Even though the JSDoc comments indicate fetchDocument (see https://github.com/ampproject/amphtml/blob/main/src/document-fetcher.js#L24) should always return a Document, it's possible for xhr.responseXML to be null if the XHR is unsuccessful, blocked, or can't be parsed.

@ampproject/wg-performance we should add a userAssert(xhr.responseXML) with a more meaningful message to indicate what request failed and why, rather than forwarding a null along for calling code to handle. We should reject, not resolve, in this case.

@samouri This is an error that would have been caught if we were a few months into the future on type-checking 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants