IamIconLiving
IamIconLiving2y ago

Supabase with trpc

When trying to configure trpc with supabase, getting this kind of error in the console tRPC failed on <no-path>: Invariant: Method expects to have requestAsyncStorage, none available The message is kind of cryptic, does anyone have an idea what this relates to?
1 Reply
IamIconLiving
IamIconLivingOP2y ago
ok it seems to relate to this
/**
* This helper generates the "internals" for a tRPC context. If you need to use it, you can export
* it from here.
*
* Examples of things you may need it for:
* - testing, so we don't have to mock Next.js' req/res
* - tRPC's `createSSGHelpers`, where we don't have req/res
*
* @see https://create.t3.gg/en/usage/trpc#-servertrpccontextts
*/
const createInnerTRPCContext = (_opts: CreateContextOptions) => {
const supabase = createClient<Database>();
return {
supabase,
};
};
/**
* This helper generates the "internals" for a tRPC context. If you need to use it, you can export
* it from here.
*
* Examples of things you may need it for:
* - testing, so we don't have to mock Next.js' req/res
* - tRPC's `createSSGHelpers`, where we don't have req/res
*
* @see https://create.t3.gg/en/usage/trpc#-servertrpccontextts
*/
const createInnerTRPCContext = (_opts: CreateContextOptions) => {
const supabase = createClient<Database>();
return {
supabase,
};
};
when I am trying to create a supabase client to pass to the context but what is requestAsyncStorage and why is not available 😄 .. ok figured it out, it was not trpc related, but my bad way of instantiating the actual database in the context