Skip to content

Commit 6a7399d

Browse files
authored
Two issues: (#318)
1. packages/ui/src/lib/supabase/client should not use dbDotEnv, but injected variables from the build process 2. There was a discrepancy between getSupabaseContext and the cucumber step mimicking it.
1 parent 6f6e957 commit 6a7399d

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

packages/database/features/step-definitions/stepdefs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { getVariant, config } from "@repo/database/dbDotEnv";
66

77
import {
88
spaceAnonUserEmail,
9-
fetchOrCreateSpaceIndirect,
9+
fetchOrCreateSpaceDirect,
1010
fetchOrCreatePlatformAccount,
1111
} from "@repo/ui/lib/supabase/contextFunctions";
1212

@@ -121,7 +121,7 @@ When(
121121
if (PLATFORMS.indexOf(platform) < 0)
122122
throw new Error(`Platform must be one of ${PLATFORMS}`);
123123
const localRefs: Record<string, any> = world.localRefs || {};
124-
const spaceResponse = await fetchOrCreateSpaceIndirect({
124+
const spaceResponse = await fetchOrCreateSpaceDirect({
125125
password: SPACE_ANONYMOUS_PASSWORD,
126126
url: `https://roamresearch.com/#/app/${spaceName}`,
127127
name: spaceName,

packages/ui/src/lib/supabase/client.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
createClient as createSupabaseClient,
44
} from "@supabase/supabase-js";
55
import { Database } from "@repo/database/types.gen";
6-
import { envContents } from "@repo/database/dbDotEnv";
76

87
// Inspired by https://supabase.com/ui/docs/react/password-based-auth
98

@@ -14,9 +13,8 @@ export type DGSupabaseClient = SupabaseClient<
1413
>;
1514

1615
export const createClient = (): DGSupabaseClient => {
17-
const env = envContents();
18-
const url = env.SUPABASE_URL;
19-
const key = env.SUPABASE_ANON_KEY;
16+
const url = process.env.SUPABASE_URL;
17+
const key = process.env.SUPABASE_ANON_KEY;
2018

2119
if (!url || !key) {
2220
throw new Error("Missing required Supabase environment variables");

0 commit comments

Comments
 (0)