Skip to content
Uint8Array error - not valid datatype (but runs fine in debugger)
Profile icon

The replit is here:

Blows up on line 149 when I run it (error: metadata should be uint8array or string). When I debug it, it works. When I run it locally it works too. Please advise as I am sure this error is on replit end.

let metadatafile = {
"name": "ALICECOI",
"description": "Alice's Artwork Coins",
"image": "",
"image_integrity": "sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=",
"properties": {
"simple_property": "Alice's first artwork",
"rich_property": {
"name": "AliceCoi",
"value": "001",
"display_value": "001",
"class": "emphasis",
"css": {
"color": "#ffffff",
"font-weight": "bold",
"text-decoration": "underline"
"array_property": {
"name": "Artwork Coins",
"value": [1, 2, 3, 4],
"class": "emphasis"
const hash = crypto.createHash('sha256');
const metadata = new Uint8Array(hash.digest());
// blows up on next line
let txn = algosdk.makeAssetCreateTxnWithSuggestedParams(addr, note,
totalIssuance, decimals, defaultFrozen, manager, reserve, freeze,
clawback, unitName, assetName, assetURL, metadata, params);

You are viewing a single comment. View All
Profile icon

refactored some code. error now on line 144. But runs fine in debug mode. To be clear error is still happening when running without debug. Please escalate, we are going into production on 9/28
// this is the line
const txn = algosdk.makeAssetCreateTxnWithSuggestedParamsFromObject({
from: alice.addr,
assetURL: url,
assetMetadataHash: metadata,
freeze: freezeAddr,
manager: managerAddr,
clawback: clawbackAddr,
reserve: reserveAddr,
suggestedParams: params,});

err Error: assetMetadataHash must be a 32 byte Uint8Array or string.
at new Transaction (/home/runner/ASAIntegrationsJS/node_modules/algosdk/dist/cjs/src/transaction.js:208:23)