Sourcemap/Sentry using publish returns null line number and column

Used postpublish hook to generate SourceMap for expo-web App. Had to comment out css imports in couple of files for it to generate map. Hook also uploaded to sentry site. I downloaded map from sentry website project settings. Sentry suggested to run following program to test sourcemap as I was still not getting correct line number in actual source file. It continued to point to the same line number in large bundle as if map had no effect whatsoever.

I ran the test program below with sourcemap file and it returns null for pos object. Are source maps not valid?

var fs = require(“fs”),
path = require(“path”),
sourceMap = require(“source-map”);

// file output by Webpack, Uglify, and so forth
var GENERATED_FILE = path.join(".", “main.jsbundle.map”);

// line and column located in your generated file (for example, the source of your error
// from your minified file)
var GENERATED_LINE_AND_COLUMN = { line: 12253, column: 9 };

var rawSourceMap = fs.readFileSync(GENERATED_FILE).toString();
new sourceMap.SourceMapConsumer(rawSourceMap).then(function(smc) {
var pos = smc.originalPositionFor(GENERATED_LINE_AND_COLUMN);

// should see something like:
// { source: ‘original.js’, line: 57, column: 9, name: ‘myfunc’ }
console.log(pos);
});


expo diagnostics LOG

WARNING: expo-cli has not yet been tested against Node.js v16.0.0.
If you encounter any issues, please report them to Issues · expo/expo-cli · GitHub

expo-cli supports following Node.js versions:

  • =12.13.0 <13.0.0 (Maintenance LTS)

  • =14.0.0 <15.0.0 (Active LTS)

  • =15.0.0 <17.0.0 (Current Release)

    Expo CLI 4.4.8 environment info:
    System:
    OS: Linux 5.4 Ubuntu 18.04.4 LTS (Bionic Beaver)
    Shell: 4.4.20 - /bin/bash
    Binaries:
    Node: 16.0.0 - ~/.nvm/versions/node/v16.0.0/bin/node
    Yarn: 1.22.4 - /usr/bin/yarn
    npm: 7.10.0 - ~/.nvm/versions/node/v16.0.0/bin/npm
    SDKs:
    Android SDK:
    API Levels: 26, 28, 29
    Build Tools: 28.0.3, 29.0.3
    System Images: android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
    npmGlobalPackages:
    expo-cli: 4.4.8
    Expo Workflow: managed

Hey @udayr, could you provide the version numbers relevant to the issue?

Thanks @adamjnav
Sure I can. I pasted expo diagnostics above … Not sure if that helps but I am unclear which version you seek?

Also, while I have your attention, I wanted to give more details. Currently, we use expo:build and npm ci to host the build output on Tomcat. Is there a postBuild hook that will generate and upload artifacts to Sentry? expo:build does not fail for ‘import css’ statements. Alternatively, can expo publish or export give an option to publish only web… I am still reading thru the documentation so pardon my ignorance here…

@adamjnav
Sorry for the train of thoughts here… We would really like expo:build or export to give us sourcemaps locally without having to upload any static or otherwise files to expo. Is there such an option?

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.