Augustas Paliulis
Augustas Paliulis
BABetter Auth
Created by Augustas Paliulis on 2/23/2025 in #bug-reports
Typescript error on plugin schema reference field
Well at least for me. Only works when it is reference
13 replies
BABetter Auth
Created by Augustas Paliulis on 2/23/2025 in #bug-reports
Typescript error on plugin schema reference field
Already tried that, it doesn't help
13 replies
BABetter Auth
Created by Augustas Paliulis on 2/23/2025 in #bug-reports
Typescript error on plugin schema reference field
can't tell you specifically, just that when using reference it is successful and also in documentation it's reference instead of references
UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "[object Array]".
at throwUnhandledRejectionsMode (node:internal/process/promises:392:7)
at processPromiseRejections (node:internal/process/promises:475:17)
at process.processTicksAndRejections (node:internal/process/task_queues:106:32) {
code: 'ERR_UNHANDLED_REJECTION'
}
UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "[object Array]".
at throwUnhandledRejectionsMode (node:internal/process/promises:392:7)
at processPromiseRejections (node:internal/process/promises:475:17)
at process.processTicksAndRejections (node:internal/process/task_queues:106:32) {
code: 'ERR_UNHANDLED_REJECTION'
}
13 replies
BABetter Auth
Created by Augustas Paliulis on 2/23/2025 in #bug-reports
Typescript error on plugin schema reference field
Is it? Because when I change to references I get an error during migration. With reference everything works find
13 replies
BABetter Auth
Created by Augustas Paliulis on 2/23/2025 in #bug-reports
Typescript error on plugin schema reference field
const tosPlugin = () => {
return {
id: 'tos-plugin',
schema: {
TermsOfService: {
fields: {
userId: {
type: 'string',
required: true,
unique: true,
reference: {
model: 'user',
field: 'id',
onDelete: 'cascade',
},
},
acceptedAt: {
type: 'date',
required: true,
},
version: {
type: 'string',
required: true,
},
},
},
},
} satisfies BetterAuthPlugin;
};
const tosPlugin = () => {
return {
id: 'tos-plugin',
schema: {
TermsOfService: {
fields: {
userId: {
type: 'string',
required: true,
unique: true,
reference: {
model: 'user',
field: 'id',
onDelete: 'cascade',
},
},
acceptedAt: {
type: 'date',
required: true,
},
version: {
type: 'string',
required: true,
},
},
},
},
} satisfies BetterAuthPlugin;
};
13 replies