TypeError: Cannot read properties of undefined (reading 'name')

Wappler Version : 5.3.2
Operating System : Windows 11
Server Model: node.js
Database Type: postgres
Hosting Type: local docker
Database field naming: snake case

Expected behavior

Fields should save without issue

Actual behavior

The fields were not saved and an error is shown in console.

TypeError: Cannot read properties of undefined (reading 'name') 
at file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:148205 
at Array.forEach (<anonymous>) 
at h (file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:148170) 
at file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:148607 at Array.forEach (<anonymous>) 
at y (file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:148291) 
at y (file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:156325) 
at file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:146629 
at Array.forEach (<anonymous>) 
at r.saveDatabaseChangesFromTree (file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:146550) 
at Object.callBack (file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:139452) 
at HTMLButtonElement.<anonymous> (file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/w2ui/w2ui.min.js:7:282087) 
at HTMLButtonElement.dispatch (C:\Users\Keith\AppData\Local\Wappler\resources\app\node_modules\jquery\dist\jquery.js:5430:27) 
at HTMLButtonElement.elemData.handle (C:\Users\Keith\AppData\Local\Wappler\resources\app\node_modules\jquery\dist\jquery.js:5234:28) 
at HTMLButtonElement.sentryWrapped (C:\Users\Keith\AppData\Local\Wappler\resources\app\node_modules\@sentry\browser\dist\helpers.js:75:23)

How to reproduce

See video for steps. Video is set to start right at error after applying database changes. Move backward to see steps before error.

It looks like the fields I was adding to the role table are showing in the db.json, but the migration file was not created.

{
  "direct": true,
  "type": "postgres",
  "connection": {
    "host": "localhost",
    "port": 9906,
    "user": "db_user",
    "password": "xxxxxxxxxx",
    "database": "brightyard_server_v2"
  },
  "schema": {
    "schemas": [
      "public"
    ],
    "tables": {
      "contact": {
        "db": {
          "schema": "public"
        },
        "columns": {
          "id": {
            "db": {
              "type": "uuid",
              "default": "uuid_generate_v4()",
              "primary": true,
              "unique": true,
              "nullable": false
            }
          }
        }
      },
      "company": {
        "db": {
          "schema": "public"
        },
        "columns": {
          "id": {
            "db": {
              "type": "uuid",
              "default": "uuid_generate_v4()",
              "primary": true,
              "unique": true,
              "nullable": false
            }
          }
        }
      },
      "activity": {
        "db": {
          "schema": "public"
        },
        "columns": {
          "id": {
            "db": {
              "type": "uuid",
              "default": "uuid_generate_v4()",
              "primary": true,
              "unique": true,
              "nullable": false
            }
          }
        }
      },
      "account": {
        "db": {
          "schema": "public"
        },
        "columns": {
          "id": {
            "db": {
              "type": "uuid",
              "default": "uuid_generate_v4()",
              "primary": true,
              "unique": true,
              "nullable": false
            }
          }
        },
        "refs": {
          "user": "account"
        }
      },
      "attachment": {
        "db": {
          "schema": "public"
        },
        "columns": {
          "id": {
            "db": {
              "type": "uuid",
              "default": "uuid_generate_v4()",
              "primary": true,
              "unique": true,
              "nullable": false
            }
          }
        },
        "refs": {
          "user": "attachment"
        }
      },
      "user": {
        "db": {
          "schema": "public"
        },
        "columns": {
          "id": {
            "db": {
              "type": "uuid",
              "default": "uuid_generate_v4()",
              "primary": true,
              "unique": true,
              "nullable": false
            }
          },
          "firstName": {
            "db": {
              "type": "string",
              "maxLength": 255,
              "primary": false,
              "unique": false,
              "nullable": true
            }
          },
          "lastName": {
            "db": {
              "type": "string",
              "maxLength": 255,
              "primary": false,
              "unique": false,
              "nullable": true
            }
          },
          "email": {
            "db": {
              "type": "string",
              "maxLength": 255,
              "primary": false,
              "unique": false,
              "nullable": true
            }
          },
          "password": {
            "db": {
              "type": "string",
              "maxLength": 255,
              "primary": false,
              "unique": false,
              "nullable": true
            }
          },
          "account": {
            "db": {
              "type": "reference",
              "primary": false,
              "unique": false,
              "nullable": true,
              "references": "id",
              "inTable": "account",
              "referenceType": "uuid",
              "onUpdate": "CASCADE",
              "onDelete": "CASCADE"
            }
          },
          "attachment": {
            "db": {
              "type": "reference",
              "primary": false,
              "unique": false,
              "nullable": true,
              "references": "id",
              "inTable": "attachment",
              "referenceType": "uuid",
              "onUpdate": "CASCADE",
              "onDelete": "CASCADE"
            }
          },
          "createdBy": {
            "db": {
              "type": "reference",
              "primary": false,
              "unique": false,
              "nullable": true,
              "references": "id",
              "inTable": "user",
              "referenceType": "uuid",
              "onUpdate": "CASCADE",
              "onDelete": "CASCADE"
            }
          },
          "updatedBy": {
            "db": {
              "type": "reference",
              "primary": false,
              "unique": false,
              "nullable": true,
              "references": "id",
              "inTable": "user",
              "referenceType": "uuid",
              "onUpdate": "CASCADE",
              "onDelete": "CASCADE"
            }
          },
          "createdDate": {
            "db": {
              "type": "timestamp",
              "default": "knex.fn.now()",
              "useTz": true,
              "primary": false,
              "unique": false,
              "nullable": true
            }
          },
          "updatedDate": {
            "db": {
              "type": "timestamp",
              "default": "knex.fn.now()",
              "useTz": true,
              "primary": false,
              "unique": false,
              "nullable": true
            }
          },
          "lastLogin": {
            "db": {
              "type": "timestamp",
              "useTz": true,
              "primary": false,
              "unique": false,
              "nullable": true
            }
          },
          "username": {
            "db": {
              "type": "string",
              "maxLength": 255,
              "primary": false,
              "unique": false,
              "nullable": true
            }
          }
        },
        "refs": {
          "role_user": "user_id",
          "permission_user": "user_id"
        }
      },
      "role": {
        "db": {
          "schema": "public"
        },
        "columns": {
          "id": {
            "db": {
              "type": "uuid",
              "default": "uuid_generate_v4()",
              "primary": true,
              "unique": true,
              "nullable": false
            }
          },
          "createdDate": {
            "db_edits": {
              "type": "datetime",
              "name": "createdDate",
              "maxLength": "",
              "default": "knex.fn.now()"
            },
            "status": {
              "new": true
            }
          },
          "updatedDate": {
            "db_edits": {
              "type": "datetime",
              "name": "updatedDate",
              "maxLength": "",
              "default": "knex.fn.now()"
            },
            "status": {
              "new": true
            }
          },
          "createdBy": {
            "db_edits": {
              "type": "reference",
              "name": "createdBy",
              "inTable": "user",
              "references": "id",
              "referenceType": "uuid",
              "onUpdate": "CASCADE",
              "onDelete": "CASCADE"
            },
            "status": {
              "new": true
            }
          },
          "updatedBy": {
            "db_edits": {
              "type": "reference",
              "name": "updatedBy",
              "default": "",
              "maxLength": "",
              "inTable": "user",
              "references": "id",
              "referenceType": "uuid",
              "onUpdate": "CASCADE",
              "onDelete": "CASCADE"
            },
            "status": {
              "new": true
            }
          },
          "name": {
            "db_edits": {
              "type": "string",
              "name": "name"
            },
            "status": {
              "new": true
            }
          },
          "shortDescription": {
            "db_edits": {
              "type": "string",
              "name": "shortDescription"
            },
            "status": {
              "new": true
            }
          },
          "description": {
            "db_edits": {
              "type": "text",
              "name": "description",
              "maxLength": ""
            },
            "status": {
              "new": true
            }
          }
        },
        "sub": {
          "role_permission": "role_id",
          "role_user": "role_id"
        }
      },
      "permission": {
        "db": {
          "schema": "public"
        },
        "columns": {
          "id": {
            "db": {
              "type": "uuid",
              "default": "uuid_generate_v4()",
              "primary": true,
              "unique": true,
              "nullable": false
            }
          }
        },
        "refs": {
          "role_permission": "permission_id"
        },
        "sub": {
          "permission_user": "permission_id"
        }
      },
      "role_permission": {
        "columns": {
          "role_id": {
            "db": {
              "type": "reference",
              "primary": false,
              "unique": false,
              "nullable": true,
              "references": "id",
              "inTable": "role",
              "referenceType": "uuid",
              "onUpdate": "CASCADE",
              "onDelete": "CASCADE"
            }
          },
          "permission_id": {
            "db": {
              "type": "reference",
              "primary": false,
              "unique": false,
              "nullable": true,
              "references": "id",
              "inTable": "permission",
              "referenceType": "uuid",
              "onUpdate": "CASCADE",
              "onDelete": "CASCADE"
            }
          }
        },
        "db": {
          "schema": "public"
        },
        "db_edits": {
          "name": "permission",
          "inTable": "permission"
        },
        "tablePrefix": "role_",
        "status": {
          "new": true
        },
        "multiReference": true,
        "parent": "role"
      },
      "role_user": {
        "columns": {
          "role_id": {
            "db": {
              "type": "reference",
              "primary": false,
              "unique": false,
              "nullable": true,
              "references": "id",
              "inTable": "role",
              "referenceType": "uuid",
              "onUpdate": "CASCADE",
              "onDelete": "CASCADE"
            }
          },
          "user_id": {
            "db": {
              "type": "reference",
              "primary": false,
              "unique": false,
              "nullable": true,
              "references": "id",
              "inTable": "user",
              "referenceType": "uuid",
              "onUpdate": "CASCADE",
              "onDelete": "CASCADE"
            }
          }
        },
        "db": {
          "schema": "public"
        },
        "db_edits": {
          "name": "user",
          "inTable": "user"
        },
        "tablePrefix": "role_",
        "status": {
          "new": true
        },
        "multiReference": true,
        "parent": "role"
      },
      "permission_user": {
        "columns": {
          "permission_id": {
            "db": {
              "type": "reference",
              "primary": false,
              "unique": false,
              "nullable": true,
              "references": "id",
              "inTable": "permission",
              "referenceType": "uuid",
              "onUpdate": "CASCADE",
              "onDelete": "CASCADE"
            }
          },
          "user_id": {
            "db": {
              "type": "reference",
              "primary": false,
              "unique": false,
              "nullable": true,
              "references": "id",
              "inTable": "user",
              "referenceType": "uuid",
              "onUpdate": "CASCADE",
              "onDelete": "CASCADE"
            }
          }
        },
        "db": {
          "schema": "public"
        },
        "db_edits": {
          "name": "user",
          "inTable": "user"
        },
        "tablePrefix": "permission_",
        "status": {
          "new": true
        },
        "multiReference": true,
        "parent": "permission"
      }
    },
    "views": {}
  }
}

Fixed in Wappler 5.3.3

@George this is still happening in 5.3.3.

TypeError: Cannot read properties of undefined (reading 'name') 
at file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:149384 
at Array.forEach (<anonymous>) 
at h (file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:149349) 
at file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:149786 
at Array.forEach (<anonymous>) 
at y (file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:149470) 
at y (file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:157510) 
at file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:147808 
at Array.forEach (<anonymous>) 
at r.saveDatabaseChangesFromTree (file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:147729) 
at Object.callBack (file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/databaseManager.js:8:140631) 
at HTMLButtonElement.<anonymous> (file:///C:/Users/Keith/AppData/Local/Wappler/resources/app/Shared/DMXzone/dmxAppCreator/UI/w2ui/w2ui.min.js:7:282087) 
at HTMLButtonElement.dispatch (C:\Users\Keith\AppData\Local\Wappler\resources\app\node_modules\jquery\dist\jquery.js:5430:27) 
at HTMLButtonElement.elemData.handle (C:\Users\Keith\AppData\Local\Wappler\resources\app\node_modules\jquery\dist\jquery.js:5234:28) 
at HTMLButtonElement.sentryWrapped (C:\Users\Keith\AppData\Local\Wappler\resources\app\node_modules\@sentry\browser\dist\helpers.js:75:23)

I scrapped the last project and started over again with a new build. So far I have not encountered this issue in the new build. That said, how do we ensure existing projects are able to continue functioning when bugs like this are encountered during the build?

I don’t want to get 100+ hours into a build to encounter similar issues that cannot be corrected.

Maybe something got corrupted in the last project due to the previous bugs. Anyway it shouldn’t happen any langer.

1 Like