ampproject / ampproject/amphtml

[Story devtools] "Story refers to page x, but no such page exists" error on slow loading player

Open
#32,873 1 comment 0 reactions 1 assignee Claimed by @mszylkowski View on GitHub
Type: Bug WG: stories
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

## What's the issue?

When the players don't load in time, they may throw these 2 errors in tandem:

> log.js:250 [amp-story] Story refers to page "page-1", but no such page exists.
push.f.g.getPageIndexById @ amp-story.js:2420
(anonymous) @ amp-story.js:2651
g.fire @ observable.js:81
g.receiveMessage @ viewer-impl.js:736
(anonymous) @ amp-viewer-integration.js:211

> amp-story.js:1432 Uncaught TypeError: Cannot read property 'element' of undefined
at jk.push.f.g.ma (amp-story.js:1432)
at amp-story.js:2649
at Y.g.fire (observable.js:81)
at Xk.g.receiveMessage (viewer-impl.js:736)
at amp-viewer-integration.js:211

which refer to https://github.com/ampproject/amphtml/blob/master/extensions/amp-story/1.0/amp-story.js#L1419-L1432.

Probably the `switchTo_` event is being applied when the story didn't load fully.

## How do we reproduce the issue?

1. Load the page http://localhost:8000/examples/visual-tests/amp-story/amp-story-dev-tools.html#development=1&url=https://preview.amp.dev/documentation/examples/introduction/stories_in_amp locally
2. Navigate to another page before all the players load
3. Error will be thrown: "Story refers to page x, but no such page exists"

@ampproject/wg-stories

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.