Cannot create table

Hi all!

I’m trying to create a new table using base.unstable_createTableAsync following the example in the guide. This is the code I’m using -

const fields = [{ name: "MyField", field: FieldType.SINGLE_LINE_TEXT }];
if (base.unstable_hasPermissionToCreateTable("MyTable", fields)) {
   await base.unstable_createTableAsync("MyTable", fields);
   // and create records
 }

But I keep getting the error

Uncaught (in promise) Error: Can't create table: invalid field config for field 'MyField'.
Creating or updating options for undefined fields is not supported at this time.
    at Mutations._assertMutationIsValid (bundle.js:formatted:7299)
    at Mutations.applyMutationAsync$ (bundle.js:formatted:6813)
    at tryCatch (bundle.js:formatted:94903)
    at Generator.invoke [as _invoke] (bundle.js:formatted:95131)
    at Generator.prototype.<computed> [as next] (bundle.js:formatted:94956)
    at tryCatch (bundle.js:formatted:94903)
    at invoke (bundle.js:formatted:94997)
    at bundle.js:formatted:95030
    at new Promise (<anonymous>)
    at callInvokeWithMethodAndArg (bundle.js:formatted:95029)

What am I doing wrong? Thanks in advance!!

You need to change field: to type:

2 Likes

Will try, thanks so much!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.