Zoom Apps Configuration
Nextjs for frontend and Firestore (Firebase) for database. Compute happens client-side.
Description
I have this page for Zoom App’s Home URL. I want to capture Meeting’s UID and send the person to another page depending on their role - participant vs host. It was perfectly fine on laptop Zoom client. However, I get the error on iOS Zoom client “FirebaseError: Failed to get document because the client is offline.” Any idea why? Why would Firebase not connect on ios but connect on laptop Zoom client?
Code
import { useEffect, useState } from "react";
import Head from "next/head";
import { useRouter } from "next/router";
import zoomSdk from "@zoom/appssdk";
import app from "@/lib/firebase";
import {
getFirestore,
doc,
setDoc,
getDoc,
serverTimestamp,
} from "firebase/firestore";
export default function ZoomPage() {
const router = useRouter();
const db = getFirestore(app);
const [feedbackList, setFeedbackList] = useState("");
useEffect(() => {
async function initializeZoomApp() {
try {
await zoomSdk.config({
popoutSize: { width: 480, height: 360 },
capabilities: ["shareApp"],
});
const userContext = await zoomSdk.getUserContext();
let { meetingUUID } = await zoomSdk.getMeetingUUID();
meetingUUID = meetingUUID.replace(/[^a-zA-Z0-9]/g, "");
const sessionRef = doc(db, "sessions", meetingUUID);
const docSnapshot = await getDoc(sessionRef);
if (!docSnapshot.exists()) {
await setDoc(sessionRef, {
createdAt: serverTimestamp(),
createdBy: "Zoom",
});
}
if (userContext.role !== "attendee") {
window.location.href = `/start?id=${meetingUUID}&zoom=true`;
} else {
window.location.href = `/join?id=${meetingUUID}&zoom=true`;
}
} catch (error) {
console.error("Error initializing Zoom App:", error);
setFeedbackList(error.message);
}
}
initializeZoomApp();
}, [router]);
return (
<>
<Head>
<meta name="robots" content="noindex, nofollow" />
<title>Zoom App</title>
</Head>
<p>{feedbackList}</p>
</>
);
}