Skip to content

ThirdPartyRequest.createBlock fails with a null pointer error #41

@ishmam-mahmud

Description

@ishmam-mahmud

Running the following code:

// run.js
import { KeyPair, ThirdPartyRequest, block } from '@biscuit-auth/biscuit-wasm';

const third = new KeyPair()
const thirdBuilder = block`
 user(123);
`;

const thirdRequest = new ThirdPartyRequest();
const thirdBlock = thirdRequest.createBlock(third.getPrivateKey(), thirdBuilder)

returns the following error message:

(node:31428) ExperimentalWarning: Importing WebAssembly modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
biscuit-wasm loading
~/node_modules/@biscuit-auth/biscuit-wasm/module/biscuit_bg.js:2504
    throw new Error(getStringFromWasm0(arg0, arg1));
          ^

Error: null pointer passed to rust
    at __wbindgen_throw (~/node_modules/@biscuit-auth/biscuit-wasm/module/biscuit_bg.js:2504:11)
    at wasm://wasm/006425f6:wasm-function[1430]:0x122550
    at wasm://wasm/006425f6:wasm-function[1431]:0x12255d
    at wasm://wasm/006425f6:wasm-function[537]:0xd8538
    at ThirdPartyRequest.createBlock (~/node_modules/@biscuit-auth/biscuit-wasm/module/biscuit_bg.js:2104:18)
    at ~/run.js:10:33
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)

Line 2104:18 on biscuit_bg.js is

wasm.thirdpartyrequest_createBlock(retptr, ptr, private_key.ptr, block_builder.ptr);

and after adding some console.logs before that line, I found that ptr is undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions