McPizza
McPizza
Explore posts from servers
BABetter Auth
Created by McPizza on 3/16/2025 in #bug-reports
TypeError: Cannot read properties of undefined (reading 'value') at withReturning
great! appreciate it
18 replies
BABetter Auth
Created by McPizza on 3/16/2025 in #bug-reports
TypeError: Cannot read properties of undefined (reading 'value') at withReturning
18 replies
BABetter Auth
Created by McPizza on 3/16/2025 in #bug-reports
TypeError: Cannot read properties of undefined (reading 'value') at withReturning
still in latest version @bekacru will keep my patches in place for now
18 replies
BABetter Auth
Created by McPizza on 3/16/2025 in #bug-reports
TypeError: Cannot read properties of undefined (reading 'value') at withReturning
ok thanks, will give it a go
18 replies
BABetter Auth
Created by McPizza on 3/16/2025 in #bug-reports
TypeError: Cannot read properties of undefined (reading 'value') at withReturning
@bekacru did you have a think about this? or should I just open an issue on GH to track?
18 replies
BABetter Auth
Created by McPizza on 3/16/2025 in #bug-reports
TypeError: Cannot read properties of undefined (reading 'value') at withReturning
18 replies
BABetter Auth
Created by McPizza on 3/16/2025 in #bug-reports
TypeError: Cannot read properties of undefined (reading 'value') at withReturning
on v1.2.3 @bekacru
18 replies
BABetter Auth
Created by McPizza on 3/16/2025 in #bug-reports
TypeError: Cannot read properties of undefined (reading 'value') at withReturning
so far my solution is to do the following:
const tId = builderVal[0]?.id?.value;
if(tId) {
const res = await db.select().from(schemaModel).where(drizzleOrm.eq(schemaModel.id, tId));
return res[0];
}
const fieldValue = builderVal[0]?.identifier?.value;
if(fieldValue) {
const res = await db.select().from(schemaModel).where(drizzleOrm.eq(schemaModel.identifier, fieldValue));
return res[0];
}
return null;
const tId = builderVal[0]?.id?.value;
if(tId) {
const res = await db.select().from(schemaModel).where(drizzleOrm.eq(schemaModel.id, tId));
return res[0];
}
const fieldValue = builderVal[0]?.identifier?.value;
if(fieldValue) {
const res = await db.select().from(schemaModel).where(drizzleOrm.eq(schemaModel.identifier, fieldValue));
return res[0];
}
return null;
obviously this only works on one type of auth table but at lease i can test more now
18 replies
BABetter Auth
Created by McPizza on 3/16/2025 in #bug-reports
TypeError: Cannot read properties of undefined (reading 'value') at withReturning
for refrence, this is how the schema looks
id: MySqlCustomColumn {
name: 'id',
keyAsName: false,
primary: true,
notNull: true,
default: undefined,
defaultFn: [Function (anonymous)],
onUpdateFn: undefined,
hasDefault: true,
isUnique: false,
uniqueName: 'verification_tokens_id_unique',
uniqueType: undefined,
dataType: 'custom',
columnType: 'MySqlCustomColumn',
enumValues: undefined,
generated: undefined,
generatedIdentity: undefined,
config: [Object],
table: [Circular *1],
sqlName: 'BINARY(16)',
mapTo: [Function: toDriver],
mapFrom: [Function: fromDriver]
},
id: MySqlCustomColumn {
name: 'id',
keyAsName: false,
primary: true,
notNull: true,
default: undefined,
defaultFn: [Function (anonymous)],
onUpdateFn: undefined,
hasDefault: true,
isUnique: false,
uniqueName: 'verification_tokens_id_unique',
uniqueType: undefined,
dataType: 'custom',
columnType: 'MySqlCustomColumn',
enumValues: undefined,
generated: undefined,
generatedIdentity: undefined,
config: [Object],
table: [Circular *1],
sqlName: 'BINARY(16)',
mapTo: [Function: toDriver],
mapFrom: [Function: fromDriver]
},
note the mapTo and mapFrom functions this is what drizzle uses to transform the custom data from and to the DB
18 replies
BABetter Auth
Created by McPizza on 3/16/2025 in #bug-reports
TypeError: Cannot read properties of undefined (reading 'value') at withReturning
heres the value of builderVal[0]
val: {
identifier: Param {
brand: undefined,
value: 'sign-in-otp-omar@mcpizza',
encoder: [MySqlVarChar]
},
value: Param {
brand: undefined,
value: '157997',
encoder: [MySqlVarChar]
},
expiresAt: Param {
brand: undefined,
value: 2025-03-16T23:52:23.981Z,
encoder: [MySqlTimestamp]
},
createdAt: Param {
brand: undefined,
value: 2025-03-16T23:47:23.981Z,
encoder: [MySqlTimestamp]
},
updatedAt: Param {
brand: undefined,
value: 2025-03-16T23:47:23.981Z,
encoder: [MySqlTimestamp]
}
}
val: {
identifier: Param {
brand: undefined,
value: 'sign-in-otp-omar@mcpizza',
encoder: [MySqlVarChar]
},
value: Param {
brand: undefined,
value: '157997',
encoder: [MySqlVarChar]
},
expiresAt: Param {
brand: undefined,
value: 2025-03-16T23:52:23.981Z,
encoder: [MySqlTimestamp]
},
createdAt: Param {
brand: undefined,
value: 2025-03-16T23:47:23.981Z,
encoder: [MySqlTimestamp]
},
updatedAt: Param {
brand: undefined,
value: 2025-03-16T23:47:23.981Z,
encoder: [MySqlTimestamp]
}
}
there is no ID column being returned
18 replies
BABetter Auth
Created by McPizza on 3/16/2025 in #bug-reports
TypeError: Cannot read properties of undefined (reading 'value') at withReturning
using planetscale via drizzle id column is a customType column (dont think it makes a difference)
18 replies