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

validator.js stopped working #36067

Closed
MadisonMiner opened this issue Sep 14, 2021 · 8 comments
Closed

validator.js stopped working #36067

MadisonMiner opened this issue Sep 14, 2021 · 8 comments

Comments

@MadisonMiner
Copy link

Description

We use the evergreen validator.js to validate AMPs before publishing, and to automatically correct errors in AMP pages.

Yesterday (9/13/21), from roughly 4:30pm to 7:15pm PT, the https://cdn.ampproject.org/v0/validator.js script file was replaced with a temporary version that did not perform validation. During this time our system was unable to update AMP pages.

Few questions:

  • Was this planned, and will this happen again?
  • If this was planned, how can we be notified of breaking changes like this in the future?
  • The temporary version of validator.js suggested migrating to validator_wasm.js. Is this really required? Or will validator.js continue to work?
  • We just started investigating validator_wasm.js, and ran into an issue. validator.js returns errors with understandable codes, for example: error.code == "DISALLOWED_ATTR, however validator_wasm.js. returns numeric codes, ie: error.code == 3 . Is it possible to update validator_wasm.js to use the string codes, to retain backwards compatibility? If not, is there a map or dictionary for the new numeric codes?

Thank you,

Reproduction Steps

No longer reproducible.

Relevant Logs

No response

Browser(s) Affected

Chrome, Firefox, Safari, Edge, UC Browser

OS(s) Affected

All

Device(s) Affected

All

AMP Version Affected

No response

@honeybadgerdontcare
Copy link
Contributor

This is a planned deprecation of the native JavaScript validator (validator.js). It has been replaced with a WebAssembly JavaScript validator(validator_wasm.js). This has already been updated in tooling such as the validator NPM package, #development=1, validator Web UI, and others listed here.

It was rolled back yesterday to give some developers an opportunity to update their tooling. We plan to roll it forward within one to two weeks. Please update tooling to use validator_wasm.js instead. The deprecated validator.js does return messaging within the exported methods that tooling needs to be updated.

To your specific questions:

  • Was this planned, and will this happen again?

Yes, and yes.

  • If this was planned, how can we be notified of breaking changes like this in the future?

We'd recommend using and updating the NPM package to stay current rather than using validator.js directly. There was an I2D for previous NPM packages that were using validator.js and those were deprecated. 1.0.35 currently uses validator_wasm.js.

  • The temporary version of validator.js suggested migrating to validator_wasm.js. Is this really required? Or will validator.js continue to work?

This is required if the tooling requires using the JavaScript file directly from the Google AMP Cache.

  • We just started investigating validator_wasm.js, and ran into an issue. validator.js returns errors with understandable codes, for example: error.code == "DISALLOWED_ATTR, however validator_wasm.js. returns numeric codes, ie: error.code == 3 . Is it possible to update validator_wasm.js to use the string codes, to retain backwards compatibility? If not, is there a map or dictionary for the new numeric codes?

The numeric codes come from the proto file for the validator. From that link the mapping can be seen from string to numeric. There isn't a plan to use the strings within validator_wasm.js but you're welcome to file an issue requesting it.

@honeybadgerdontcare
Copy link
Contributor

@MadisonMiner Also, I wanted to apologize that this caused a disruption to your tooling and workflow. Those working on AMP validation can be reached on amphtml.slack.com under #validator-discuss or #wg-caching.

@MadisonMiner
Copy link
Author

@honeybadgerdontcare, thanks for the response, and the link to validator.proto, that will make migration easier.

@honeybadgerdontcare
Copy link
Contributor

We will be publishing a new validator_wasm.js this week that will return the named error codes instead of the numeric. I'll provide an update once this is launched.

@MadisonMiner
Copy link
Author

Awesome! That will save us a lot of time. Thank you.

@honeybadgerdontcare
Copy link
Contributor

@MadisonMiner validator_wasm.js is now returning the string representation for error code.

@honeybadgerdontcare
Copy link
Contributor

Please see #36110 for Intent-to-Deprecate and add any questions or concerns there.

@MadisonMiner
Copy link
Author

@honeybadgerdontcare , thanks again! The string error codes helped. We are migrated to validator_wasm.js

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

2 participants