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

i18n strings in artifacts from -G throw errors when run through -A #9269

Closed
connorjclark opened this issue Jun 24, 2019 · 2 comments
Closed
Assignees
Labels
i18n internationalization thangs internals P1.5

Comments

@connorjclark
Copy link
Collaborator

Provide the steps to reproduce

node lighthouse-cli https://www.example.com -G and when Chrome pops up immediately move it out of focus to force NO_FCP

node lighthouse-cli https://www.example.com -A --view

What is the current behavior?

Runtime error encountered: Cannot read property 'icuMessage' of undefined
TypeError: Cannot read property 'icuMessage' of undefined
    at _resolveIcuMessageInstanceId (/Users/cjamcl/src/lighthouse/lighthouse-core/lib/i18n/i18n.js:300:24)
    at replaceInObject (/Users/cjamcl/src/lighthouse/lighthouse-core/lib/i18n/i18n.js:327:55)
    at replaceInObject (/Users/cjamcl/src/lighthouse/lighthouse-core/lib/i18n/i18n.js:340:9)
    at Object.replaceIcuMessageInstanceIds (/Users/cjamcl/src/lighthouse/lighthouse-core/lib/i18n/i18n.js:347:3)
    at Function.run (/Users/cjamcl/src/lighthouse/lighthouse-core/runner.js:155:39)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
    at startup (internal/bootstrap/node.js:282:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

What is the expected behavior?

no error.

@exterkamp exterkamp added the i18n internationalization thangs label Jun 24, 2019
@brendankenny brendankenny changed the title ICU replacement errors for -G w/ NO_FCP i18n strings in artifacts from -G throw errors when run through -A Jul 18, 2019
@brendankenny
Copy link
Member

brendankenny commented Jul 18, 2019

ICU replacement errors for -G w/ NO_FCP
Runtime error encountered: Cannot read property 'icuMessage' of undefined

unfortunately not fixed by #9397 like I initially thought it would be. This string is in LighthouseRunWarnings in the artifacts. At the end of then running LH with -A, the localization step tries to look up the string but it's not in _icuMessageInstanceMap because the str() call happened in the gather phase, not the current run.

However, there's a deeper problem with fixing: even if we did a lookup based on the id, for strings with replacement like the NO_FCP warning (badTraceRecording), the replacement values are long gone, so the string can't be reconstructed anyways.

We could

  • do a replacer/reviver for i18n strings in artifacts
  • or some kind of icuMessagePaths but for artifacts and swap upon loading them
  • or come up with a new icuMessage format

we can call this medium priority. This is the only instance I know of after #9397 handles LHErrors, and only happens if you run just -G and then just -A (so basically just us), but it could happen more if we want to e.g. pipe localized strings from gatherers all the way to audits.

@brendankenny
Copy link
Member

fixed in #10630

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n internationalization thangs internals P1.5
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants