Lighthouse-ci: Upload seems to be broken since v0.4.1

Created on 7 Jul 2020  ·  5Comments  ·  Source: GoogleChrome/lighthouse-ci

I've tested the upload target temporary-public-storage as well as filesystem both with the same result. At least temporary-public-storage is working with lhci <= v0.4.0:

lhci autorun --upload.target=temporary-public-storage
[...]
TypeError: Cannot read property 'trim' of null
    at getCurrentBranchRaw_ (/usr/local/lib/node_modules/@lhci/cli/node_modules/@lhci/utils/src/build-context.js:127:32)
    at getCurrentBranch (/usr/local/lib/node_modules/@lhci/cli/node_modules/@lhci/utils/src/build-context.js:139:18)
    at Object.buildCommand (/usr/local/lib/node_modules/@lhci/cli/src/upload/upload.js:111:16)
    at Object.builder (/usr/local/lib/node_modules/@lhci/cli/src/cli.js:56:17)
    at Object.runCommand (/usr/local/lib/node_modules/@lhci/cli/node_modules/yargs/lib/command.js:186:35)
    at Object.parseArgs [as _parseArgs] (/usr/local/lib/node_modules/@lhci/cli/node_modules/yargs/yargs.js:1063:30)
    at Object.get [as argv] (/usr/local/lib/node_modules/@lhci/cli/node_modules/yargs/yargs.js:1004:21)
    at run (/usr/local/lib/node_modules/@lhci/cli/src/cli.js:82:45)
    at Object.<anonymous> (/usr/local/lib/node_modules/@lhci/cli/src/cli.js:120:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
P1 bug

Most helpful comment

Aha!! Yes thank you so much @maxocub 0.4.1 moved to "slim" docker versions.

All 5 comments

Thanks very much for filing @xoxys! Are you 100% sure it's 0.4.1? The code path in your stack trace hasn't changed since 0.3.9 -> 0.4.0 and those line numbers don't correspond to 0.4.1.

Also, it's worth noting that this error is only obscuring the true error message but LHCI is going to fail either way if no branch name can be determined (a fix in 0.3.9 to prevent unintentional behavior). A temporary workaround would be setting the LHCI_BUILD_CONTEXT__CURRENT_BRANCH environment variable.

We'll fix the error message either way though 👍

I have used your docker images to test it :) so I'm pretty sure 0.4.0 was working while 0.4.1 was not but I could check this again.

Same for me, everything works fine with docker image patrickhulce/lhci-client:0.4.0, but with 0.4.1 or 0.4.2 I get:

lighthouse_1  | Running Lighthouse...
lighthouse_1  | ✅  .lighthouseci/ directory writable
lighthouse_1  | ✅  Configuration file found
lighthouse_1  | ✅  Chrome installation found
lighthouse_1  | Healthcheck passed!
lighthouse_1  | 
lighthouse_1  | Running Lighthouse 1 time(s) on http://django:8000/fr/
lighthouse_1  | Run #1...done.
lighthouse_1  | Done running Lighthouse!
lighthouse_1  | 
lighthouse_1  | TypeError: Cannot read property 'trim' of null
lighthouse_1  |     at getCurrentBranchRaw_ (/usr/local/lib/node_modules/@lhci/cli/node_modules/@lhci/utils/src/build-context.js:127:32)
lighthouse_1  |     at getCurrentBranch (/usr/local/lib/node_modules/@lhci/cli/node_modules/@lhci/utils/src/build-context.js:139:18)
lighthouse_1  |     at Object.buildCommand (/usr/local/lib/node_modules/@lhci/cli/src/upload/upload.js:111:16)
lighthouse_1  |     at Object.builder (/usr/local/lib/node_modules/@lhci/cli/src/cli.js:56:17)
lighthouse_1  |     at Object.runCommand (/usr/local/lib/node_modules/@lhci/cli/node_modules/yargs/lib/command.js:186:35)
lighthouse_1  |     at Object.parseArgs [as _parseArgs] (/usr/local/lib/node_modules/@lhci/cli/node_modules/yargs/yargs.js:1063:30)
lighthouse_1  |     at Object.get [as argv] (/usr/local/lib/node_modules/@lhci/cli/node_modules/yargs/yargs.js:1004:21)
lighthouse_1  |     at run (/usr/local/lib/node_modules/@lhci/cli/src/cli.js:82:45)
lighthouse_1  |     at Object.<anonymous> (/usr/local/lib/node_modules/@lhci/cli/src/cli.js:120:1)
lighthouse_1  |     at Module._compile (internal/modules/cjs/loader.js:1138:30)WARNING: upload command failed.
lighthouse_1  | 
lighthouse_1  | Done running autorun.

Is it possible that the docker images patrickhulce/lhci-client:0.4.1 and 0.4.2 are missing git?

$ docker run patrickhulce/lhci-client:0.4.0 git --version
git version 2.11.0
$ docker run patrickhulce/lhci-client:0.4.1 git --version
internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module '/home/lhci/reports/git'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

[EDIT] Yeah, I think git is missing, 0.4.0 use node:10 as base image and 0.4.1 and up use node:12-buster-slim which does not include git.

Aha!! Yes thank you so much @maxocub 0.4.1 moved to "slim" docker versions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mauriciabad picture mauriciabad  ·  4Comments

trptcolin picture trptcolin  ·  5Comments

mathiasbynens picture mathiasbynens  ·  4Comments

xavierfoucrier picture xavierfoucrier  ·  4Comments

felixck12 picture felixck12  ·  4Comments