Skip to content

better error message for wasi #30878

Description

@gengjiawen

when preopens directory not really exists, Node.js failed with

node[55811]: ../src/node_wasi.cc:88:node::wasi::WASI::WASI(node::Environment *, Local<v8::Object>, uvwasi_options_t *): Assertion `(uvwasi_init(&uvw_, options)) == (0)' failed.
 1: 0x100081683 node::Abort() [/usr/local/bin/node]
 2: 0x10008142b node::AppendExceptionLine(node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Message>, node::ErrorHandlingMode) [/usr/local/bin/node]
 3: 0x1000e58be node::wasi::WASI::WASI(node::Environment*, v8::Local<v8::Object>, uvwasi_options_s*) [/usr/local/bin/node]
 4: 0x1000e5e5b node::wasi::WASI::New(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 5: 0x1001ec8d0 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
 6: 0x1001ebb9d v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
 7: 0x1001eb557 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
 8: 0x100951939 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/usr/local/bin/node]
fish: 'node --experimental-wasi-unstab…' terminated by signal SIGABRT (Abort)

Repro code:

"use strict";
const fs = require('fs');
const { WASI } = require('wasi');
const wasi = new WASI({
    args: process.argv,
    env: process.env,
    preopens: {
        '/sandbox': '/not/real/path'
    }
})

I think maybe we can add some pre-check here ? The current error message doesn't provide much information.

cc @nodejs/wasi

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.wasiIssues and PRs related to the WebAssembly System Interface.wasmIssues and PRs related to WebAssembly.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions