ampproject / ampproject/amp.dev

Playground: amp-script-src injection is broken

Open
#5,519 3 comments 0 reactions 1 assignee Claimed by @matthiasrohmer View on GitHub
Category: Playground P2: Medium Type: Bug
Dominant language
HTML
Stars
600
Forks
675
PR merge metrics
No merged PRs in 30d

Description

## 🐛 Bug Report

I tried copying the [from a local element](https://amp.dev/documentation/components/amp-script/#from-a-local-element) sample into the playground and the result was an error showing up in the console:

```
Uncaught ReferenceError: Buffer is not defined
at calculateHash (main.3265082c626cf940fc7a.js:2)
at main.3265082c626cf940fc7a.js:2
at Array.map ()
at Zt._getInlineHashes (main.3265082c626cf940fc7a.js:2)
at Zt.update (main.3265082c626cf940fc7a.js:2)
at vn (main.3265082c626cf940fc7a.js:2)
at main.3265082c626cf940fc7a.js:2
at Array.forEach ()
at I.publish (main.3265082c626cf940fc7a.js:2)
at main.3265082c626cf940fc7a.js:2
```

In the `head`, an empty `amp-script-src` is added:

```html

```

And the `amp-script` example in the preview does nothing when the button is clicked.

I'm testing in Chrome 89 on a Mac. I also tested in Firefox and I get the same error.

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.