pilcrowOnPaper / lucia-adapter-astrodb

Astro DB adapter for Lucia.
MIT License
95 stars 6 forks source link

Sesson id that is inserted is different than what is initially logged. #8

Closed vacarsu closed 3 months ago

vacarsu commented 3 months ago

Session id logged when session is created plw3dgqfw75qsxa09bktfidd663dk8xveojg0u2h

Session id logged from session inserted in db

[ { id: '1.0', expiresAt: 2024-04-25T18:20:01.912Z, userId: 1 } ]

My table definitions

const User = defineTable({
  columns: {
    id: column.number({ primaryKey: true }),
    email: column.text(),
    name: column.text(),
    password: column.text(),
    role: column.text(),
    createdAt: column.date(),
    updatedAt: column.date(),
  },
});

const Session = defineTable({
  columns: {
    id: column.text({
      primaryKey: true
    }),
    expiresAt: column.date(),
    userId: column.number({
      references: () => User.columns.id
    })
  }
});

I'm also getting type errors as I'm not using text ids for the User table.

vacarsu commented 3 months ago

My mistake when creating the session I thought the attributes param was the user attributes so I was passing in the userId there.