Cannot read properties of undefined

I have a problem when I run this code:


deserializeReceiveReturnValue( 
ReturnValue.toBuffer(res.returnValue),
ToBuffer(GENERATOR_CONTRACT_SCHEMA, 'base64'),
ContractName,
EntrypointName.fromStringUnchecked('view'));

I checked the parameters and data, schema, etc. using https://sctools.mainnet.concordium.software/ and they were correct.

but I get the following error message:

concordium Cannot read properties of undefined (reading ‘__wbindgen_add_to_stack_pointer’).

Does anyone know where the problem is?

Could you give more context please? Which contract address on testnet are getting this error (is the source code open source by chance)? What values do you use for res.returnValue, GENERATOR_CONTRACT_SCHEMA and ContractName do you use?

it is the frontend for the final task in the concordium academy. I just want to call up the view function of my smart contract. I get data in the buffer and a success. But as soon as I want to deserialize, the error occurs.

AUCTION_CONTRACT_NAME = cis2_subscription_auctions
AUCTION_CONTRACT_INDEX = 8663
AUCTION_CONTRACT_SUB_INDEX = 0
AUCTION_CONTRACT_SCHEMA = //8DAQAAABoAAABjaXMyX3N1YnNjcmlwdGlvbl9hdWN0aW9ucwEAFAADAAAAAwAAAGVuZA0NAAAAbWluaW11bV9yYWlzZQUTAAAAcGFydGljaXBhdGlvbl90b2tlbhQAAgAAAAgAAABjb250cmFjdAwIAAAAdG9rZW5faWQdAAUAAAADAAAAYmlkAxUGAAAACwAAAE9ubHlBY2NvdW50AhIAAABCaWRCZWxvd0N1cnJlbnRCaWQCFAAAAEJpZEJlbG93TWluaW11bVJhaXNlAgoAAABCaWRUb29MYXRlAg4AAABBdWN0aW9uTm90T3BlbgIPAAAATm90QVBhcnRpY2lwYW50AggAAABmaW5hbGl6ZQMVAwAAABIAAABBdWN0aW9uU3RpbGxBY3RpdmUCDgAAAEF1Y3Rpb25Ob3RPcGVuAhEAAABDaXMyVHJhbnNmZXJFcnJvcgIPAAAAb25SZWNlaXZpbmdDSVMyAxUFAAAACwAAAFBhcnNlUGFyYW1zAgwAAABDb250cmFjdE9ubHkCCwAAAE9ubHlBY2NvdW50AgwAAABVbkF1dGhvcml6ZWQCGQAAAEF1Y3Rpb25BbHJlYWR5SW5pdGlhbGl6ZWQCBAAAAHZpZXcBFAAGAAAADQAAAGF1Y3Rpb25fc3RhdGUVAwAAAA4AAABOb3RJbml0aWFsaXplZAIKAAAATm90U29sZFlldAEBAAAAFAADAAAACAAAAGNvbnRyYWN0DAgAAAB0b2tlbl9pZB0ABgAAAGFtb3VudBslAAAABAAAAFNvbGQBAQAAAAsOAAAAaGlnaGVzdF9iaWRkZXIVAgAAAAQAAABOb25lAgQAAABTb21lAQEAAAALDQAAAG1pbmltdW1fcmFpc2UFAwAAAGVuZA0TAAAAcGFydGljaXBhdGlvbl90b2tlbhQAAgAAAAgAAABjb250cmFjdAwIAAAAdG9rZW5faWQdAAwAAABwYXJ0aWNpcGFudHMQAgsOAAAAdmlld0hpZ2hlc3RCaWQBCgA=

const info = await client.grpcClient.getInstanceInfo(ContractAddress.create(AUCTION_CONTRACT_INDEX, AUCTION_CONTRACT_SUB_INDEX));
        const contractName = ContractName.fromInitName(info.name);

 const res = await client.grpcClient.invokeContract({
            method: ReceiveName.fromString(`${AUCTION_CONTRACT_NAME}.view`),
            contract: ContractAddress.create(AUCTION_CONTRACT_INDEX, AUCTION_CONTRACT_SUB_INDEX),
            parameter: Parameter.empty(),
        });

 returnValue = deserializeReceiveReturnValue(
                ReturnValue.toBuffer(res.returnValue),
                toBuffer(AUCTION_CONTRACT_SCHEMA, 'base64'),
                contractName,
                EntrypointName.fromStringUnchecked('view'));

could you provide the value of res/res.returnValue before it is parsed into the deserializeReceiveReturnValue. A call to the node can always fail. So that value should be first checked if it returns an error, and only if not then we can deserialze the res.returnValue as a return_value.