ampproject / error-reporting

Contains production error tracking issues.
Apache License 2.0
2 stars 5 forks source link

🚨 Error: undefined is not an object (evaluating 'this.bb().getLayoutSize') #51

Closed ampprojectbot closed 3 years ago

ampprojectbot commented 3 years ago

Details

Error report: link First seen: Jan 9, 2021 Frequency: ~ 4,110/day

Stacktrace

Error: undefined is not an object (evaluating 'this.bb().getLayoutSize')
    at getLayoutSize (src/custom-element.js:1002:33)
    at builtins/amp-img.js:270:20
    at src/custom-element.js:1118:39
    at fn (src/utils/promise.js:75:12)
    at resolve (src/utils/promise.js:74:22)
    at src/custom-element.js:1118:33
    at signal (src/service/resource.js:950:46)
    at state (src/service/vsync-impl.js:469:25)
    at tasks (src/service/vsync-impl.js:426:18)

Notes

@dvoytenko modified src/custom-element.js:996-1004 in #31762 (Jan 7, 2021) @dvoytenko modified builtins/amp-img.js:270-271 in #31762 (Jan 7, 2021) @zhouyx modified src/custom-element.js:1118-1118 in #15410 (May 18, 2018) @jridgewell modified src/utils/promise.js:75-78 in #15143 (May 8, 2018) @renovate-bot modified src/utils/promise.js:74-74 in #27350 (Mar 30, 2020) @zhouyx modified src/custom-element.js:1118-1118 in #15410 (May 18, 2018) @jridgewell modified src/service/resource.js:950-950 in #20814 (Feb 14, 2019) @jridgewell modified src/service/vsync-impl.js:469-470 in #20836 (Feb 14, 2019) @rsimha modified src/service/vsync-impl.js:426-426 in #23363 (Jul 17, 2019)

Seen in:

Possible assignees: @dvoytenko, @rsimha

/cc @ampproject/release-on-duty

rcebulko commented 3 years ago

@dvoytenko this started appearing in small volumes 1/9 (probably the first Nightly build that contained https://github.com/ampproject/amphtml/pull/31762 from 1/7) and has grown in volume as it reached Beta/Experimental. Appears to be related to the changes in amp-img or custom-element.

rcebulko commented 3 years ago

/cc @samouri as reviewer of ampproject/amphtml#31762 Looks like this error is occurring only on iPhone user-agents

Errors surface across both ESM and non-ESM builds

Stacktrace indicates this.getResource_() is returning undefined. That function call evaluates to this.getResources().getResourceForElement(this) returning undefined

samouri commented 3 years ago

Two potential dupes:

  1. https://pantheon.corp.google.com/errors/CL749-nM2JHyzQE?time=P30D&filter=text%3AgetLayoutSize&project=amp-error-reporting&folder&organizationId=433637338589
  2. https://pantheon.corp.google.com/errors/CLXF7LrbjqyNZw?time=P30D&filter=text%3AgetLayoutSize&project=amp-error-reporting&folder&organizationId=433637338589

The error means the Resource doesn't exist for the img and is happening during layoutCallback. The only way I can guess for an img to get to that state would be if it was disconnect()ed and didn't have its layoutCallback cancelled correctly.

samouri commented 3 years ago

Could be that this section of code needs to include ResourceState.LAYOUT_SCHEDULED:

https://github.com/ampproject/amphtml/blob/6c58c508906c88431d2471ddf2c2c5b00edd64c3/src/service/resources-impl.js#L1913-L1917

samouri commented 3 years ago

Looks like the fix worked. Bug is not appearing in nightlies or beta anymore.