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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃毃 Error: Cannot read property 'length' of null #28260

Closed
ampprojectbot opened this issue May 7, 2020 · 7 comments 路 Fixed by #28285
Closed

馃毃 Error: Cannot read property 'length' of null #28260

ampprojectbot opened this issue May 7, 2020 · 7 comments 路 Fixed by #28285
Assignees
Labels
Type: Error Report An error reported by AMP Error Reporting WG: components

Comments

@ampprojectbot
Copy link
Member

ampprojectbot commented May 7, 2020

Details

Error report: link
First seen: Apr 9, 2020
Frequency: ~ 455,777/day

Stacktrace

Error: Cannot read property 'length' of null
    at url (https://raw.githubusercontent.com/ampproject/amphtml/2005050322000/src/service/url-expander/expander.js:75:9)
    at expand (https://raw.githubusercontent.com/ampproject/amphtml/2005050322000/src/service/url-replacements-impl.js:889:44)
    at urlReplacements (https://raw.githubusercontent.com/ampproject/amphtml/2005050322000/extensions/amp-social-share/0.1/amp-social-share.js:141:11)
    at layoutCallback (https://raw.githubusercontent.com/ampproject/amphtml/2005050322000/src/custom-element.js:1153:39)
    at fn (https://raw.githubusercontent.com/ampproject/amphtml/2005050322000/src/utils/promise.js:75:12)
    at https://raw.githubusercontent.com/ampproject/amphtml/2005050322000/src/utils/promise.js:74:9
    at tryResolve (https://raw.githubusercontent.com/ampproject/amphtml/2005050322000/src/custom-element.js:1153:22)
    at layoutCallback (https://raw.githubusercontent.com/ampproject/amphtml/2005050322000/src/service/resource.js:908:18)
    at callback (https://raw.githubusercontent.com/ampproject/amphtml/2005050322000/src/service/vsync-impl.js:470:16)

Notes

@calebcordry modified src/service/url-expander/expander.js:75-75 in #12682 (Jan 20, 2018)
@rsimha modified src/service/url-replacements-impl.js:889-893 in #21212 (May 16, 2019)
@caroqliu modified extensions/amp-social-share/0.1/amp-social-share.js:141-160 in #28100 (Apr 30, 2020)
@zhouyx modified src/custom-element.js:1152-1153 in #15410 (May 18, 2018)
@jridgewell modified src/utils/promise.js:75-78 in #15143 (May 8, 2018)
@zhouyx modified src/custom-element.js:1152-1153 in #15410 (May 18, 2018)
@jridgewell modified src/service/resource.js:905-913 in #20814 (Feb 14, 2019)
@jridgewell modified src/service/vsync-impl.js:470-471 in #20836 (Feb 14, 2019)

Seen in:

  • 05-05 Experimental (0322)
  • 04-25 Stable (2135)

Possible assignees: @jridgewell, @zhouyx

/cc @ampproject/release-on-duty

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

rcebulko commented May 7, 2020

/cc @caroqliu This seems related to #28100, think you could take a peek?

@rcebulko
Copy link
Contributor

rcebulko commented May 7, 2020

Note: This has existed in other forms for a while, but it spiked a bunch when the latest Experimental was promoted on 05-06 this week. Since it's mostly appearing in Experimental, this is probably related to some experiment being run

@rcebulko
Copy link
Contributor

rcebulko commented May 7, 2020

image

@jridgewell
Copy link
Contributor

It's because social-share does an early return in buildCallback, and does toggle(false) in those cases to make it display: none. But, making an element display: none doesn't always prevent the element from receiving layoutCallback. (I'm looking into why this is.)

When this early return happens, there's no shareEndpoint_ value set. And we then call expandUrlAsync with a null value.

Instead, we should throw an error in buildCallback. That should prevent layoutCallback from firing in all cases.

/to @caroqliu

@caroqliu
Copy link
Contributor

caroqliu commented May 8, 2020

Until the layoutCallback bug is resolved -- I'd prefer to directly check shareEndpoint_ or element visibility in the layoutCallback to early return instead of calling expandUrlAsync. I'm not sure I agree with throwing a different error earlier to avoid this error later.

@rcebulko
Copy link
Contributor

rcebulko commented May 8, 2020

^^^ +1

@rcebulko
Copy link
Contributor

rcebulko commented May 8, 2020

Great work taking care of this so quickly!

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

Successfully merging a pull request may close this issue.

4 participants