Uncaught Error Error: Error: Error while executing command 'fibery.entity/create': Cannot parse value for Name field in 'namespace/database' database

import Fibery from 'fibery-unofficial';
const fibery = new Fibery({
  host: "XXX.fibery.io",
  token: 'YYY'
});

await fibery.entity.createBatch([
    {
    'type': 'test/Database 1',
    'entity': {
      'Name': 'Curtly Ambrose',
    }
  }
]);

I get this error:

Uncaught Error Error: Error: Error while executing command 'fibery.entity/create': Cannot parse value for Name field in 'test/Database 1' database.
Cause: Name field was not found in 'test/Database 1' database.

I think the names are correct:

Do you know what happens?

When using fibery createBatch and executeSingleCommand methods, you need to use the “native” field names found in fibery.getSchema().

e.g.

  • Id field name is “'fibery/id”
  • Name field name is `${spaceName}/Name`
  • All custom field names are also of the form `${spaceName}/fieldName`

Check the docs & examples here: Fibery API

The name test/Database 1 seems to be correct:

const schema = await fibery.getSchema({
  'with-description': true
});
console.log(schema.filter(x=>x['fibery/name']==='test/Database 1'))
// Worked

Oh I get it. You mean the key value of the entity object. I worked out the correct code:

await fibery.entity.createBatch([
  {
    'type': 'test/Database 1',
    'entity': {
      'test/Name': 'Curtly Ambrose',
    }
  }
]);
1 Like

Today I get the same error. However it only happens in one specific database. In database 456z from space Source of host torihi.fibery.io, I get:

Uncaught (in promise) Error: Error: Error while executing command 'fibery.entity/create': Cannot parse value for Source/Name field in Source/456z database.
Cause: Source/Name field was not found in Source/456z database.
    at file:///C:/Users/ganuo/AppData/Local/deno/npm/registry.npmjs.org/fibery-unofficial/0.2.1/source/command.js:52:19
    at Object.runMicrotasks (ext:core/01_core.js:838:30)
    at processTicksAndRejections (ext:deno_node/_next_tick.ts:53:10)
    at runNextTicks (ext:deno_node/_next_tick.ts:71:3)
    at eventLoopTick (ext:core/01_core.js:189:21)
    at async Ä‘áş©yLĂŞnFibery (file:///D:/QC%20supplements/Code/Apps/Tr%E1%BA%A5n%20K%E1%BB%B3/B%20X%E1%BB%AD%20l%C3%BD%20d%E1%BB%AF%20li%E1%BB%87u%20v%C3%A0%20%C4%91%E1%BA%A9y%20l%C3%AAn%20Fibery/4.%20T%E1%BA%A1o%20k%E1%BA%BFt%20qu%E1%BA%A3/4.2%20%C4%90%E1%BA%A9y%20l%C3%AAn%20fibery.ts:11:2)

However in database 123, the exact same code works fine. Curling the schema both databases are registered. Do you know why?

Your API call is specifying test/Name as the entity name field, but the error mentions that it expects to find Source/Name.

No, there is no space test here. I post it here because it has the same error, not because it’s a continuation of the previous error.

Did you rename the “Name” field in the Source DB?

No I don’t. In fact I thought it’s not posible to rename

Have you queried the schema to check your field titles?

You are right. It has been renamed to Source/name. I wonder why it is the case?