emil
emil
Explore posts from servers
TTCTheo's Typesafe Cult
Created by emil on 8/1/2023 in #questions
Weird auth.js type behaviour with custom providers
I made a custom magic link email login provider for auth.js and it all works fine and dandy with no type errors to be seen; however, as soon as do a full app typecheck, while ignoring node modules on sveltekit, somehow the auth.js library types feelsverysadmanwowcry has anyone else ran to a similar issue? There is nothing inherently wrong with my ts config and my custom provider abides to the auth.js types for providers too.
2 replies
TTCTheo's Typesafe Cult
Created by emil on 7/5/2023 in #questions
TypeError: client[procedureType] is not a function weirdness
I'm trying to make an adapter for auth.js and want to call my backend via the adapter with tRPC proxy client. For some weird reason I get this error and don't know why exactly :// if anyone knows what might be going on
2 replies
TtRPC
Created by emil on 7/5/2023 in #❓-help
TypeError: client[procedureType] is not a function
Has anyone encountered this error before? I'm trying to implement an adapter for Auth.js that can communicate with my backend via tRPC proxy client but I keep getting this error for some reason. This is how i call my route:
import { client } from "../data"
export default function StorefrontApiAdapter() {
return {
async createUser(user) {
const result = await client.authorization.createUser.mutate(user)
return { ...user, id: result.id }

},
async getUser(id) {
const user = await client.authorization.getUser.query(id)
return user
},
async getUserByEmail(email) {
const user = await client.authorization.getUserByEmail.query(email)
return user
},
async getUserByAccount({ providerAccountId, provider }) {
const userByAccount = await client.authorization.getUserByAccount.query(providerAccountId)
return userByAccount
},
async linkAccount(account) {
await client.authorization.linkAccount.mutate(account)
return account
},
[...]
}
}
import { client } from "../data"
export default function StorefrontApiAdapter() {
return {
async createUser(user) {
const result = await client.authorization.createUser.mutate(user)
return { ...user, id: result.id }

},
async getUser(id) {
const user = await client.authorization.getUser.query(id)
return user
},
async getUserByEmail(email) {
const user = await client.authorization.getUserByEmail.query(email)
return user
},
async getUserByAccount({ providerAccountId, provider }) {
const userByAccount = await client.authorization.getUserByAccount.query(providerAccountId)
return userByAccount
},
async linkAccount(account) {
await client.authorization.linkAccount.mutate(account)
return account
},
[...]
}
}
And this is my client:
export const client = createTRPCProxyClient<AppRouter>({
links: [
httpBatchLink({
url: `${PUBLIC_STOREFRONT_API}/trpc`,
}),
],
})
export const client = createTRPCProxyClient<AppRouter>({
links: [
httpBatchLink({
url: `${PUBLIC_STOREFRONT_API}/trpc`,
}),
],
})
16 replies