-
| Hi Team I think I setup the SDK But I got the message Error: SDK not found. useSdk must be called from within a provider |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
| Hi @grojas123, It looks like you only have a provider for Auth and Database. In your |
Beta Was this translation helpful? Give feedback.
-
| I wanna test a bit with firebase and the storage on my Nextjs App. Thats my code of the page that im visiting for testing. import { useStorage, useStorageDownloadURL } from 'reactfire'; import { ref } from 'firebase/storage'; export function Setups() { const storage = useStorage(); const testRef = ref(storage, 'Setups/il0n5yecjakf1tisly9se8_bmw_zolder_race'); const { status, data } = useStorageDownloadURL(testRef); return ( <> <p>Hello World from Setups Component</p> </> ); }Thats how i setup the Providers: <FirebaseAppProvider firebaseConfig={firebaseConfig}> <FirebaseSDKProviders> <Component {...pageProps} /> </FirebaseSDKProviders> </FirebaseAppProvider>firebase-provider.tsx import { FirestoreProvider, useFirebaseApp } from 'reactfire'; import { getFirestore } from 'firebase/firestore'; import { ChildrenProps } from './children-props'; export function FirebaseSDKProviders({ children }: ChildrenProps) { const app = useFirebaseApp(); const firestore = getFirestore(app); return <FirestoreProvider sdk={firestore}>{children}</FirestoreProvider>; }firebase.ts export const firebaseConfig = { apiKey: process.env.FIREBASE_API_KEY, authDomain: process.env.FIREBASE_AUTH_DOMAIN, projectId: process.env.FIREBASE_PROJECT_ID, storageBucket: process.env.FIREBASE_STORAGE_BUCKET, messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID, appId: process.env.FIREBASE_APP_ID, measurementId: process.env.FIREBASE_MEASUREMENT_ID }Is there something that im missing? |
Beta Was this translation helpful? Give feedback.
Hi @grojas123,
It looks like you only have a provider for Auth and Database. In your
Displayphotoscomponent, you are usinguseStorage(), but you do not have a provider for storage yet. Try doing the same thing you did with Auth and Database but addStorageProvider.