Skip to content

Error in nodejs: You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize #432

Description

@arthabus

I was using source-maps for a bit on my nodejs server and it was working just fine. But now out of a sudden it started to crash with the below error when I try to create a SourceMapConsumer:

Error: You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer
at readWasm (.../myNodeApp/functions/node_modules/source-map/lib/read-wasm.js:8:13)
at wasm (.../myNodeApp/functions/node_modules/source-map/lib/wasm.js:25:16)
at .../myNodeApp/functions/node_modules/source-map/lib/source-map-consumer.js:264:14
at runMicrotasks ()

Is this expected on node? I was never calling the initialize before and it seems like it's only required in browser?

Here is my code snippet:

const sourceMap = require('source-map'); //version "^0.7.3"

let contents = {...} //a json with a valid sourceMap content
let consumer = await new sourceMap.SourceMapConsumer(contents); //<- it now fails here with the above error

I've already tried to revert all my code back to when it was working but the error is still there.

Could anyone point me in the right direction on why this may be happening?

As a note, I've tried to provide the url as it's shown in the web browser usage page but it then fails with "response.arrayBuffer is not a function" internally while it tries to parse the file. I guess that happens because it wasn't able to download the file in the node environment in the first place, but again it seems like the problem is that it shouldn't ask for the url in node at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions