I'm getting 'Error: Impossible to convert undefined to Principal' when calling motoko code

I’m trying to call this motoko function from my frontend (users is a previously declared HashMap):

public func storeid(proton_account : Text, ic_id : Text) : async Text {
    
    users.put(proton_account, ic_id);
    let numusers = users.size();
    return ic_id # " and " # proton_account # ", number of users = " # Nat.toText(numusers);
};

The Javascript console reports:

Uncaught (in promise) Error: Impossible to convert undefined to Principal.
at Function.from (index.js:29)
at caller (actor.js:171)
at CanisterActor.handler [as storeid] (actor.js:195)
at HTMLButtonElement.ic_storeid (App.svelte:136)

It doesn’t seem to matter what parameters I call the function with. I can even hardcode 2 strings in the call e.g. const dfinity_result = await cronacle_frontend.storeid(“abc”, “def”) - I still get the same error.

There is nothing in my code that refers to the Principal type. Does anyone know what might be generating this error?

Hey, I got the same error.
After fixing the variable ***_CANISTER_ID in the file custom-webpack.config.js it worked fine.