permaweb / aos

An operating system for AO: The hyper parallel computer
https://ao.g8way.io
Other
74 stars 52 forks source link

returning "hashmap" tables with 0 as key for a val fails silently or crashes AOS #261

Open nikooo777 opened 4 months ago

nikooo777 commented 4 months ago

assume this table:

{
   0 = "value here"
}

with 0 being an integer (if it's a string it works fine).

if this table (t) is bundled like this:

secretObj = {Secrets = t}

the resulting value should be:

{
   Secrets = {
     0 = "value here"
  }
}

now, if secretObj is returned like this:

Handlers.utils.reply(secretObj)(msg)

it will somewhat silently fail. using a dry run, this is what I see in the network tab:

{"Messages":[],"Assignments":[],"Spawns":[],"Output":"","Error":{}}

using AOS acutally causes a crash:

aos> Send({Target=ao.id, Data=secretObj})
file:///home/niko/.nvm/versions/node/v20.12.0/lib/node_modules/@permaweb/aos/src/services/errors.js:17
  const errorMessage = error.replace(
                             ^

TypeError: error.replace is not a function
    at parseError (file:///home/niko/.nvm/versions/node/v20.12.0/lib/node_modules/@permaweb/aos/src/services/errors.js:17:30)
    at Interface.<anonymous> (file:///home/niko/.nvm/versions/node/v20.12.0/lib/node_modules/@permaweb/aos/src/index.js:332:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.12.0