question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Travis CI failing `should properly compose sourcemaps when multiple transformations are chained` test

See original GitHub issue

Here’s the error I see in the most recent build:

gulp-google-[secure]: TypeError: Cannot read property 'b' of null
    at l6b (/home/travis/build/google/[secure]/node_modules/[secure]-npm/packages/google-[secure]-js/jscomp.js:8755:375)
    at zxd (/home/travis/build/google/[secure]/node_modules/[secure]-npm/packages/google-[secure]-js/jscomp.js:8175:160)
    at h2b (/home/travis/build/google/[secure]/node_modules/[secure]-npm/packages/google-[secure]-js/jscomp.js:6209:103)
    at Z1b (/home/travis/build/google/[secure]/node_modules/[secure]-npm/packages/google-[secure]-js/jscomp.js:8416:290)

which causes a test failure

  1) gulp-google-[secure]
       javascript version
         should properly compose sourcemaps when multiple transformations are chained:
     Uncaught Error: gulp-google-[secure]: Compilation errors occurred
      at CompilationStream._compilationComplete (lib/gulp/index.js:256:28)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lauraharkercommented, Jul 15, 2020

I’ve debugged the sourcemap issue some more. Here’s the stack trace causing a test failure w/ a pretty-printed GWT compiler:

gulp-google-closure-compiler: TypeError: Cannot read property 'fileName' of null
    at $getSourceMapping (/usr/local/google/home/lharker/git/closure-compiler/node_modules/closure-compiler-npm/packages/google-closure-compiler-js/jscomp.js:37108:251)
    at $addMapping_0 (/usr/local/google/home/lharker/git/closure-compiler/node_modules/closure-compiler-npm/packages/google-closure-compiler-js/jscomp.js:92406:21)
    at $generateSourceMap (/usr/local/google/home/lharker/git/closure-compiler/node_modules/closure-compiler-npm/packages/google-closure-compiler-js/jscomp.js:35005:7)
    at toSource (/usr/local/google/home/lharker/git/closure-compiler/node_modules/closure-compiler-npm/packages/google-closure-compiler-js/jscomp.js:34936:22)
    at $build_12 (/usr/local/google/home/lharker/git/closure-compiler/node_modules/closure-compiler-npm/packages/google-closure-compiler-js/jscomp.js:34944:10)
    at $toSource_1 (/usr/local/google/home/lharker/git/closure-compiler/node_modules/closure-compiler-npm/packages/google-closure-compiler-js/jscomp.js:37909:10)
[...]

Here’s the compiled $getSourceMapping method:

function $getSourceMapping(this$static, sourceName, lineNumber, columnNumber){
  var consumer, relativePath, result, resultOriginalPath, source, sourceMap, sourceMapOriginalPath;
  if (sourceName == null) {
    return null;
  }
  sourceMap = castTo($get_23(this$static.inputSourceMaps, sourceName), 434);
  if (!sourceMap) {
    return null;
  }
  consumer = $getSourceMap(sourceMap, this$static.errorManager);
  if (!consumer) {
    return null;
  }
  result = $getMappingForLine(consumer, lineNumber, columnNumber + 1);
  if (!result) {
    return null;
  }
  sourceMapOriginalPath = sourceMap.sourceFile.fileName;
  resultOriginalPath = result.originalFile;
  source = null;
  if ($equals_19(sourceMapOriginalPath, this$static.resolvedSourceMap.originalPath) && $equals_19(resultOriginalPath, this$static.resolvedSourceMap.sourceMapPath)) {
    source = this$static.resolvedSourceMap.sourceFile;
  }
   else {
    relativePath = resolveSibling(sourceMapOriginalPath, resultOriginalPath);
    source = $getSourceFileByName(this$static, relativePath);
    if (!source && !!resultOriginalPath) {
      source = null;
      !!source && $putIfAbsent_0(this$static.sourceMapOriginalSources, relativePath, source);
    }
    this$static.resolvedSourceMap.originalPath = sourceMapOriginalPath;
    this$static.resolvedSourceMap.sourceMapPath = resultOriginalPath;
    this$static.resolvedSourceMap.sourceFile = source;
  }
  return $build_6($setColumnPosition($setOriginalFile($setIdentifier($setColumnPosition($setLineNumber($setOriginalFile(new Mapping$OriginalMapping$Builder, result.originalFile), result.lineNumber), result.columnPosition), result.identifier), source.fileName), result.columnPosition - 1));
}

The stack trace points to the last line in the function,

  return $build_6($setColumnPosition($setOriginalFile($setIdentifier($setColumnPosition($setLineNumber($setOriginalFile(new Mapping$OriginalMapping$Builder, result.originalFile), result.lineNumber), result.columnPosition), result.identifier), source.fileName), result.columnPosition - 1));

implying that source is null.

This function corresponds togetSourceMapping in Compiler.java: https://github.com/google/closure-compiler/blob/4bf54b232b13162f6c621b2d1f12cddab5b00701/src/com/google/javascript/jscomp/Compiler.java#L2871

https://github.com/google/closure-compiler/commit/dac995ac563bfe3170280899112699845768e135 introduced a reference to source in the return for that function without first checking that it’s non-null. Probably source was already null in the GWT compiled test before that commit, but it just didn’t matter earlier.

I don’t know why it’s only null in the GWT tests though. That might be an unrelated bug?

1reaction
lauraharkercommented, Jul 14, 2020

Bradford pointed out that prior to https://github.com/google/closure-compiler/commit/dac995ac563bfe3170280899112699845768e135 the Travis build was failing with what looks like a timeout.

[INFO] --- gwt-maven-plugin:1.0-rc-6:compile (default-compile) @ [secure]-gwt ---
[INFO] Compiling module com.google.JsComp
No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#build-times-out-because-no-output-was-received
Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Build Problems - Travis CI Docs
A very common cause when a test is suddenly breaking without any major code changes involved is a change in upstream dependencies. This...
Read more >
@jest/source-map | Yarn - Package Manager
Jest will set process.env.NODE_ENV to 'test' if it's not set to something else. You can use that in your configuration to conditionally setup...
Read more >
rollup changelog
Fix a situation where invalid code was rendered when dynamically importing a module with synthetic named exports when preserving modules (#3738) ...
Read more >
Mapping Crime: Principle and Practice
using crime mapping technology, we hope this guide will spark ideas about new ways to use it. Jeremy Travis. Director. National Institute of...
Read more >
Best Practices and Common Mistakes with Travis CI ...
For simple changes like these, add “[ci skip]” to your commit message, and Travis will automatically skip that build. The other common reason...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found