Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an error while using Amp Html Validator package #38401

Open
skyhawk14 opened this issue Aug 11, 2022 · 8 comments
Open

Getting an error while using Amp Html Validator package #38401

skyhawk14 opened this issue Aug 11, 2022 · 8 comments

Comments

@skyhawk14
Copy link

Description

Facing issue with amphtml-validator v1.0.35 . While using validateString for validating AMP email it is throwing an error. Few months back this was working fine. Getting below error message. Anyone aware about any recent major change with the package dependency or about the issue which I am getting?

Reproduction Steps

Issue is replicated here: https://codesandbox.io/s/happy-cannon-kdrbxt?file=/src/App.js

Relevant Logs

{
    "message": "Assertion failed: WebAssembly is uninitialized"
}

Browser(s) Affected

No response

OS(s) Affected

No response

Device(s) Affected

No response

AMP Version Affected

No response

@mszylkowski
Copy link
Contributor

Hi, check out https://codesandbox.io/s/mystifying-minsky-ijsei4?file=/src/App.js which worked for me. When clicking on the button, it shows the error properly:

image

@skyhawk14
Copy link
Author

skyhawk14 commented Aug 11, 2022

Hi @mszylkowski , Thanks for looking at the issue. But for me I am getting this when I tried using the link which you shared.
image

I am trying this on Chrome Version 104.0.5112.79 (Official Build) (arm64)

@mszylkowski
Copy link
Contributor

That is interesting, I was on Chrome 103 (working) and just updated to Chrome 104 and it stopped working...

@skyhawk14
Copy link
Author

skyhawk14 commented Aug 11, 2022

This explains its not working in chrome with the latest build but it is not working in other other browsers like safari (Version 15.5 (17613.2.7.1.8)) and in Firefox also. Is there any update happen with validator_wasm.js , are you aware about it? @mszylkowski

@mszylkowski
Copy link
Contributor

Found a way to fix this temporarily: const instance = await amphtmlValidator.getInstance("https://cdn.ampproject.org/v0/validator.20211101.deprecated.js");

The underlying error comes from a breakage of the API since #36110. I'll direct this issue towards someone that can fix the validator, and comment on that issue.

@mszylkowski
Copy link
Contributor

I've added a comment that the NPM package doesn't work properly.

FYI:

Another alternative is to directly use the script:
<script src="https://cdn.ampproject.org/v0/validator_wasm.js"></script>

and doing window.amp.validator.init().then(() => {doHereYourStuff})

@skyhawk14
Copy link
Author

skyhawk14 commented Aug 15, 2022

@mszylkowski
Second approach works for me. First approach of using javascript validator we can't do it as it as this is deprecated.

@zhangsu
Copy link
Member

zhangsu commented Jan 6, 2023

@antiphoton @amaltas do you mind taking a look? It looks like it's been broken since Chrome 104.

kdy1 added a commit to vercel/next.js that referenced this issue Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants