Hi All, First thank you for all of the support you give. It is super impressive and useful! I would not have been able to get this far right now. I am trying to link firebase into Wix. Predominantly a password-validated database entry, but i wanted to see if I could just database entry working. (Password validation works but it pulls from an external javascript https://www.gstatic.com/firebasejs/5.8.2/firebase.js). So I build a simple button with a wix website. It doesn't work. When I try to initialize a firebase app, Wix appears to error out saying " Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information.
It is very reproducible for me. Here is my simplified code.
// code in backend/firebaseModule.jsw // Firebase App (the core Firebase SDK) is always required and // must be listed before other Firebase SDKs console.log('pree start') import firebase from 'firebase/app'; import { initializeApp } from 'firebase/app'; import { firestore } from 'firebase/app'; // Add the Firebase products that you want to use // require('firebase/firestore'); require('firestore'); console.log('post start') const firebaseConfig = { apiKey: "xxxxx", authDomain: "xxxxx.firebaseapp.com", databaseURL: "https://xxxxx-default-rtdb.firebaseio.com", projectId: "xxx", storageBucket: "dmbo-ehcq.appspot.com", messagingSenderId: "xxxx", appId: "xxxxx" }; export async function setData(data) { console.log("data to be set is ", data); // uncommenting the line below causes the below error. // Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information. // let db = firestore(); // Uncommenting this line does the same // let db = firebase.firestore();
initializeApp(firebaseConfig);
var response = data.animal
return response
}
In my page code it is:
import { setData } from "backend/firebaseModule.jsw"
$w.onReady(function () {
// when users click the submit button, execute the code inside
$w("#submitButton").onClick(() => {
// first we collect the date from the input fields by calling their value
var message = $w('#message').value;
var animal = $w('#animal').value;
// we initialize a variable call data and it's a map of the data we collected
let data = {
"animal": animal,
"message": message,
}
console.log("External data:", data)
// call the setData method from backend/firebaseModule.jsw we imported
setData(data)
.then(
(response) => {
// when the data is set, a response "Done" will return
console.log("internal here:")
console.log(response)
}
).catch((error) => {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
console.log("Error is: ")
console.log(errorMessage);
});
});
});
This gives the unfortunate error, which you can see
Error is:
createConsoleProxy.ts:47 Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information.
I cannot seem to find this error's solution. I've tried many variant solutions. It seems to me that this is something fundamental. As in, Wix will not run the backend function for me? I cannot see any site monitoring information as per the bug indicated! (the logs the Wix console don't seem to register this action)
What do you think I should look into to make this happen? Thank you for all the insight you can reveal!
This is the frontend error message. Error object are censured to avoid any security leak in the frontend.
You'll have a better error message in your logging system (site events/ google operation)