The following code throws an error when .getReceipt()
is invoked.
Note that the transaction itself is successful.
const hcsTopicCreateTx = await new TopicCreateTransaction()
.freezeWith(client)
.sign(operatorKey);
const hcsTopicCreateTxResponse = await hcsTopicCreateTx.execute(client);
const hcsTopicCreateReceipt = await hcsTopicCreateTxResponse.getReceipt();
This is the error:
file:///Users/user/code/hedera/hedera-code-snippets/hcs-topic-permissioned-write/node_modules/@hashgraph/sdk/src/Executable.js:518
? client._logger != null
^
TypeError: Cannot read properties of undefined (reading '_logger')
at TransactionReceiptQuery.execute (file:///Users/user/code/hedera/hedera-code-snippets/hcs-topic-permissioned-write/node_modules/@hashgraph/sdk/src/Executable.js:518:26)
at TransactionResponse.getReceipt (file:///Users/user/code/hedera/hedera-code-snippets/hcs-topic-permissioned-write/node_modules/@hashgraph/sdk/src/transaction/TransactionResponse.js:81:54)
at main (file:///Users/user/code/hedera/hedera-code-snippets/hcs-topic-permissioned-write/hcs-write.js:60:66)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Why is _logger
missing?
Here is how the client
object was initialised:
const client = Client.forTestnet().setOperator(operatorId, operatorKey);
Also tried manually initialising the logger on client
like so:
const client = Client.forTestnet().setOperator(operatorId, operatorKey);
client.setLogger(new Logger(LogLevel.Warn));
However, the same error persisted. How can this be resolved?