Skip to content

Not able to read from amp state since version 012305051745000 #38967

@marcmrf

Description

@marcmrf

Description

It looks like we're experiencing some issues reading from AMP state since May 16th, I guess release day for version 012305051745000.
Under development mode, using #development=1 together with AMP.printState(), we can see state is properly populated.

However, trying to acess it from amp-script is always returning null.

Changing v0.js script src for using lts version fixes the issue.

Reproduction Steps

Amp state is populated using a remote endpoint,

<amp-state
        id="flowcardsState"
        src="https://flowcards.mrf.io/json/active?page_technology=1&site_id=1659&client_id=CLIENT_ID(compass_uid)&canonical_url=CANONICAL_URL&hostname=CANONICAL_HOSTNAME&location=CANONICAL_URL&referrer=EXTERNAL_REFERRER&page_view_id_64=PAGE_VIEW_ID_64&scroll_height=SCROLL_HEIGHT&geo=__INJECT_GEO__&cid=_ga:CLIENT_ID(AMP_ECID_GOOGLE,,_ga),comScore:CLIENT_ID(comScore),compass_uid:CLIENT_ID(compass_uid)&version=sha384-hAIbiZrdxhM8FeqN8_RTibnHiVNzYCNbohecvMNstJFsRzNYCq8wVzyv1EImMrk9"
      ></amp-state>

Which populates flowcardsState with the following content

{
    "active": true,
    "amp": {
        "cid": "_ga:amp-Bf9I0PQTbwK-0c8SGjPGhg,comScore:amp-wFdYHp1nE6MJRB_GIsxOqw,compass_uid:amp-DFfJ8g0S-vpwKGYp71ig-w",
        "hostname": "lxcugy.csb.app",
        "location": "https://lxcugy.csb.app/",
        "referrer": "https://codesandbox.io/",
        "runtimeUrl": "https://flowcards.mrf.io/statics/experience-amp/sha384-hAIbiZrdxhM8FeqN8_RTibnHiVNzYCNbohecvMNstJFsRzNYCq8wVzyv1EImMrk9/flowcards-content.html",
        "siteId": "1659",
        "pageViewId64": "5RIg2DW-GA1hqnVS2zYbuw",
        "scrollHeight": "360"
    }
}

Both playgrounds are using flowcardsState.amp.siteId for replacing will change text. Only difference between them is v0.js version.

Playground using master version: https://codesandbox.io/s/dreamy-water-lxcugy?file=/index.html
Playground using lts version: https://codesandbox.io/s/inspiring-darwin-7yr68m?file=/index.html

In addtion,

resources loaded in master version

master-assets

resources loaded in LTS version because getState is returning content
LTS-assets

Relevant Logs

No response

Browser(s) Affected

No response

OS(s) Affected

No response

Device(s) Affected

No response

AMP Version Affected

012305051745000

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions