I am making a UI Kit global page app. The app is completed and fully functional in develop, but when I push to production, the router.navigate function stops working.
In the documentation, it says the router is in the preview stage. It also says that preview stage objects are not available to production environment by default, but that you can opt into using the feature. Is this my issue? I can not find any way to get these permissions.
See these pages for reference on the preview features for “router” that I need access to in production environment!
https://developer.atlassian.com/platform/forge/apis-reference/ui-api-bridge/router/#:~:text=The%20router%20object%20enables%20you,on%20the%20user’s%20browser%20configuration.
https://developer.atlassian.com/platform/forge/apis-reference/ui-api-bridge/router/#:~:text=The%20router%20object%20enables%20you,on%20the%20user’s%20browser%20configuration.%C2%A0%20https://developer.atlassian.com/platform/forge/whats-coming/
Hi, @AbelHaynes
This feature should work as expected in the production
environment without additional setup.
Would you mind share a bit detail around how it’s not working for you so we can try to replicate the issue.
Additionally, the common reasons that the router.navigate
fails to work could because:
- the content the app is trying to navigate to does not exist
- the app does not have permission to navigate to the target content
you can try observe in the network tab in the browser to see if there are related errors on the network requests triggered by the router.navigate
Thanks!
Hello @SolomanWeng , thanks for reaching out!
After some more troubleshooting, I was able to narrow down the issue to requests I am making to firebase storage using the firebase SDK. The error I receive in the console is a 25 second timeout error.
The code works fine in tunnel, but not when deploying to any environment. Is this a common issue? How can I access my firestore database when not running on my local machine?
See code below for firestore
import admin from "firebase-admin";
import { storage, webTrigger } from "@forge/api";
import fs from "fs";
import { ProjectSettingsPage } from "@forge/ui";
// Load Firebase credentials
const serviceAccount = {
type: process.env.FB_TYPE,
project_id: process.env.FB_PROJECT_ID,
private_key_id: process.env.FB_PRIVATE_KEY_ID,
private_key: `-----BEGIN PRIVATE KEY-----\n${process.env.FB_PRIVATE_KEY.replace(/\\n/g, '\n')}\n-----END PRIVATE KEY-----\n`,
client_email: process.env.FB_CLIENT_EMAIL,
auth_uri: process.env.FB_AUTH_URI,
auth_provider_x509_cert_url: process.env.FB_AUTH_PROVIDER_X509_CERT_URL,
client_x509_cert_url: process.env.FB_CLIENT_X509_CERT_URL,
universe_domain: process.env.UNIVERSE_DOMAIN
}
// Initialize Firebase Admin SDK
if (!admin.apps.length) {
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
});
}
const db = admin.firestore();
// Function to store web trigger in Firestore
export async function storeWebTrigger(webTrigURL, trimURL) {
//////////////// The timeout occurs on the line below///////////////////
return await db.collection("webTriggers").doc(trimURL).set({webTrigURL});
}
Hi, @AbelHaynes
Thanks for reaching out.
Please ensure that the firebase urls are whitelisted in the manifest file, so the egress connections is not blocked:
thanks.
Hey @SolomanWeng,
I did include the firebase URL’s in the manifest. I tried different firebase URL’s to be thorough, but it does not work.
external:
fetch:
backend:
- 'https://slack.com'
- 'https://firestore.googleapis.com'
- 'https://iam.googleapis.com'
- 'https://oauth2.googleapis.com'
- 'https://www.googleapis.com'
- 'https://firestore.googleapis.com'
- 'https://project-name.firebaseio.com'
- 'https://us-central1-project-name-scheduling.cloudfunctions.net
Hi, @AbelHaynes
Interesting. I think the connection issue can be coming from both Forge and Firebase side. You might want to check if your Firebase also whitelist the communication from the Forge apps:
Please refer to:
for more details.
Additionally, please also share the details on the connection issues you have seen (e.g. network requests, or console errors etc.)
In the mean time, I will also try connect you with team that have dedicated knowledge on this. Thanks.
Additionally, forge runtime support only https
communication with additional restrictions after deploy to the site, forge tunnel
might not have same restriction.
Hence, please also try check if Firebase uses the support communication as indicated in the documentation.
It is also possible to utilise
as an alternative, thanks!
Hello all,
The issue is that forge node.js sandbox blocks essential functionalities for the firebase SDK to work. The SDK worked when tunneling because I was using my local environment instead of the actual atlassian environment.
My workaround was to use a REST API to access my storage. Firebase thankfully has one.