timothymiller / t4-app

A powerful cross-platform UI toolkit for building actually native iOS, Android, macOS, Windows, Linux, and Progressive Web Apps with React (Native).
https://t4stack.com
MIT License
1.45k stars 77 forks source link

supabaseUrl/imageUrl is required error being thrown until adding the `console.log` line #90

Closed tonyabracadabra closed 11 months ago

tonyabracadabra commented 11 months ago
image

I got the error above after filling in the env.local for the env variables,

interestingly, when I add a console.log in the file below, the error dissapears

import { createClient } from '@supabase/supabase-js'
import * as SecureStore from 'expo-secure-store'
import 'react-native-url-polyfill/auto'

const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL as string
// this is the line I added to make the error go away
console.log('print anything here')

I suppose there must be some env variable loading problems that causes this?

Similarly for imageURL

import { SolitoImageProvider as SolitoImageProviderOG } from 'solito/image'

const imageURL = process.env.NEXT_PUBLIC_APP_URL as `http:${string}` | `https:${string}`
// this is, again, the line I have to add to make the error go away
console.log('printanything')
timothymiller commented 11 months ago

We do need to add typing to the environment variables to make it clearer which ones are missing.

tonyabracadabra commented 11 months ago

We do need to add typing to the environment variables to make it clearer which ones are missing.

I think the env variables are in .env.local but just not loaded correctly until the console.log line is added, and of course we can have t3-env here

rmarscher commented 11 months ago

https://github.com/timothymiller/t4-app/pull/96 should fix this. The typescript cast syntax seemed to prevent the env vars from being replaced.

albbus-stack commented 11 months ago

@tonyabracadabra If you can please confirm that now it is working so we can close this issue. Thank you 🤟

timothymiller commented 11 months ago

Let's keep this open until we add typings to env vars access.

albbus-stack commented 11 months ago

@tonyabracadabra @rmarscher I implemented typesafe environment variables using t3-env in the latest PR #102. It would be great if you test that and let me know 🤘

timothymiller commented 11 months ago

I released three major features for T4 App today

👉 Android support for local API & Image access 👉 .env shim for unifying env vars across Expo, Next, and Cloudflare Wrangler 👉 Expo 49 support

Onboarding new users to the T4 App Stack has never been easier!