ampproject / ampproject/amphtml
failed to build: amp-animation: Found 0 <script> children. Expected 1.
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
I'm having the exact same problem as this [issue](https://github.com/ampproject/amphtml/issues/38632).
On some loads the page has the error "Uncaught (in promise) Resource: failed to build: amp-animation#200: Found 0 children. Expected 1." even tho the script tags are present inside the amp-animation tags.
<img width="726" alt="image" src="https://github.com/ampproject/amphtml/assets/86956142/04df44f5-5659-4225-8cbf-f2db37ef7108">
<img width="485" alt="image" src="https://github.com/ampproject/amphtml/assets/86956142/19aa65f9-11a1-4986-9565-61ace206382d">
<img width="722" alt="image" src="https://github.com/ampproject/amphtml/assets/86956142/a688000e-b9f3-41e2-9f6c-2771d9624b88">
<img width="721" alt="image" src="https://github.com/ampproject/amphtml/assets/86956142/2616ae41-4633-4cbe-ae83-abd9aeed8ee5">
### Reproduction Steps
https://www.ucpa.com/
refresh page until you'll see these amp-animation errors (Uncaught (in promise) Resource: failed to build: amp-animation#200: Found 0 <script> children. Expected 1.) in dev tool's console.
### Relevant Logs
```shell
Found 0 <script> children. Expected 1. amp-animation#showNavBarPin-1616077145994.i-amphtml-layout-nodisplay.i-amphtml-element.i-amphtml-notbuilt.amp-notbuilt.i-amphtml-error
Uncaught (in promise) Resource: failed to build: amp-animation#190: Found 0 <script> children. Expected 1.
at https://cdn.ampproject.org/v0/amp-animation-0.1.mjs:2:68843
at cs.buildCallback (https://cdn.ampproject.org/v0/amp-animation-0.1.mjs:2:69267)
at https://cdn.ampproject.org/v0.mjs:2:58648
error-reporting.js:201 Found 0 <script> children. Expected 1. <amp-animation id="showNavBarPin-1616077190234" layout="nodisplay" class="i-amphtml-layout-nodisplay i-amphtml-element i-amphtml-notbuilt amp-notbuilt i-amphtml-error" hidden i-amphtml-layout="nodisplay"><script type="application/json">{"duration":"0ms","fill":"both","iterations":"1","animations":[{"selector":["#pin-1616077190234"],"keyframes":[{"opacity":"1","visibility":"visible"}]}]}
wn @ error-reporting.js:201
(anonymous) @ custom-element.js:601
Promise.then (async)
buildInternal @ custom-element.js:553
build @ resource.js:328
Lu @ resources-impl.js:442
Uu @ resources-impl.js:421
ku @ resources-impl.js:399
Du @ resources-impl.js:382
upgraded @ resources-impl.js:494
vs @ custom-element.js:419
Bs @ custom-element.js:1327
Ps @ custom-element.js:1250
connectedCallback @ custom-element.js:1212
```
### Browser(s) Affected
Chrome
### OS(s) Affected
macOS 13.5
### Device(s) Affected
macbook pro m2
### AMP Version Affected
2308181609000
Contributor guide
Research direction
Reproduce the intermittent error at https://www.ucpa.com/ by refreshing until the amp-animation message appears. Start with the amp-animation implementation and the stack-trace entry points in error-reporting.js, custom-element.js, resource.js, and resources-impl.js; inspect existing amp-animation tests. Done means the reported page no longer intermittently fails and regression coverage verifies the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100