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

Fix lts #781

Merged
merged 3 commits into from
May 20, 2020
Merged

Fix lts #781

merged 3 commits into from
May 20, 2020

Conversation

sebastianbenz
Copy link
Collaborator

The new runtime parameter handling resulted in the LTS option no longer
working. Moving lts + ampRuntimeVersion in fetchRuntimeParameters.

This PR also improves logging and fixes a bug where the styles fallback
did not work.

The new runtime parameter handling resulted in the LTS option no longer
working. Moving lts + ampRuntimeVersion in fetchRuntimeParameters.

This PR also improves logging and fixes a bug where the styles fallback
did not work.

Fixes #777
Fallback to cdn.ampproject.org if custom runtime host cannot be
resolved
@sebastianbenz
Copy link
Collaborator Author

@mdmower would be great if you could take a look.

@@ -17,11 +17,12 @@

const {AMP_CACHE_HOST, appendRuntimeVersion} = require('./AmpConstants.js');

function calculateHost({ampUrlPrefix = AMP_CACHE_HOST, ampRuntimeVersion, lts, rtv = false}) {
if (lts && ampRuntimeVersion) {
throw new Error('lts flag is not compatible with runtime version parameter');
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this error is worth keeping, but if (lts && ampRuntimeVersion) should be replaced with if (lts && rtv).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. Added.

`Could not download runtime version from ${ampUrlPrefix}. Falling back to ${AMP_CACHE_HOST}`
);
ampRuntimeData = await fetchLatestRuntimeData_({config, AMP_CACHE_HOST, lts}, versionKey);
} else if (versionKey) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to store bad results? If not:
} else if (ampRuntimeData.version && versionKey) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator Author

@sebastianbenz sebastianbenz left a comment

Choose a reason for hiding this comment

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

@mdmower - thanks for the review. PTAL

@@ -17,11 +17,12 @@

const {AMP_CACHE_HOST, appendRuntimeVersion} = require('./AmpConstants.js');

function calculateHost({ampUrlPrefix = AMP_CACHE_HOST, ampRuntimeVersion, lts, rtv = false}) {
if (lts && ampRuntimeVersion) {
throw new Error('lts flag is not compatible with runtime version parameter');
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. Added.

`Could not download runtime version from ${ampUrlPrefix}. Falling back to ${AMP_CACHE_HOST}`
);
ampRuntimeData = await fetchLatestRuntimeData_({config, AMP_CACHE_HOST, lts}, versionKey);
} else if (versionKey) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@sebastianbenz sebastianbenz merged commit 3a6534d into master May 20, 2020
@sebastianbenz sebastianbenz deleted the fix-lts branch May 20, 2020 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants