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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Catch invalid json responses in amp-addthis #23431

Merged
merged 1 commit into from Jul 22, 2019

Conversation

jridgewell
Copy link
Contributor

@jridgewell jridgewell commented Jul 19, 2019

It appears (from our error logs) that the JSON requests occasionally return invalid JSON. Maybe something to do with ad blocking?

Fixes #19253.

/cc @taojing10 @dmvjs @pjcunnin @matthinegardner

It appears (from our error logs) that the JSON requests occasionally return invalid JSON.
Copy link
Contributor

@zhouyx zhouyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. I saw a lot of .json() call in our codebase. Do you think we should introduce some tryParseJson method, and forbid the .json() call?

});
}
},
() => {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to send a user error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a server error, I'm not sure it'd be useful.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Agree

@jridgewell jridgewell merged commit 2e69cc0 into ampproject:master Jul 22, 2019
rindo pushed a commit to logly/amphtml that referenced this pull request Jul 24, 2019
It appears (from our error logs) that the JSON requests occasionally return invalid JSON.
thekorn pushed a commit to edelight/amphtml that referenced this pull request Sep 11, 2019
It appears (from our error logs) that the JSON requests occasionally return invalid JSON.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

amp-add-this: Error: The string did not match the expected pattern.
3 participants