Ok, I switched to the following, but same error.
function login(email, password, callback) {
    callback(null, {
        user_id: 'Hipster|1',
        email_verified: true,
        email: email,
        app_metadata: {
          "test": ["a", "b", "c"]
      }
    });
}
I get the error when I do Save and Try, enter email/pass and I get a popup with the error message:
DB Custom script (login): invalid fields. Errors: The field “test” contains an invalid type, expected any of string, int, float, boolean, array, object.
I can also see it if I click try connection, enter email/pass, click login, the go to Auth0 dashboard/monitoring/logs and I can see an entry with these raw details:
{
  "client_id": "fGoGdscpXYLojpSWzPBYVA2JCUaletQ0",
  "client_name": "All Applications",
  "connection": "ad-migration",
  "connection_id": "con_sUmslxDzRGbHYnwg",
  "date": "2024-07-05T12:33:33.019Z",
  "description": "DB Custom script (login): invalid fields. Errors: The field \"test\" contains an invalid type, expected any of string, int, float, boolean, array, object.",
  "details": {
    "error": {
      "message": "DB Custom script (login): invalid fields. Errors: The field \"test\" contains an invalid type, expected any of string, int, float, boolean, array, object."
    }
  },
  "ip": "-",
  "strategy": "auth0",
  "strategy_type": "database",
  "type": "f",
  "user_agent": "Edge 126.0.0 / Windows 10.0.0",
  "user_id": "",
  "user_name": "asd@asd.com",
  "log_id": "90020240705123333201480000000000000001223372041951576689",
  "tenant_name": "-",
  "_id": "90020240705123333201480000000000000001223372041951576689",
  "isMobile": false,
  "id": "90020240705123333201480000000000000001223372041951576689"
}
and the same error in context data:
{
  "error": {
    "message": "DB Custom script (login): invalid fields. Errors: The field \"test\" contains an invalid type, expected any of string, int, float, boolean, array, object."
  }
}