Issue with sending data to a firebase database

Hey there,

I’ve been experimenting with a plugin idea recently and I’ve come across a strange issue having to do with sending over data to a firebase realtime database.

The exact same code (a simple write operation) runs fine in a browser, but gives me this error:

plugin:obsidian-sample-plugin:2916 Uncaught TypeError: Cannot set property doc of #<Node> which has only a getter
    at FirebaseIFrameScriptHolder.createIFrame_ (plugin:obsidian-sample-plugin:2916:18)
    at new FirebaseIFrameScriptHolder (plugin:obsidian-sample-plugin:2871:50)
    at eval (plugin:obsidian-sample-plugin:2674:30)
    at executeWhenDOMReady (plugin:obsidian-sample-plugin:2146:5)
    at BrowserPollConnection.open (plugin:obsidian-sample-plugin:2670:5)
    at eval (plugin:obsidian-sample-plugin:3465:32)

This my code for the write operation:

const firebaseConfig = {
	...
};

const firebaseApp = initializeApp(firebaseConfig);
const db = getDatabase(firebaseApp);

export default class MyPlugin extends Plugin {
	settings: MyPluginSettings;


	async onload() {
		await this.loadSettings();
		
		function writeUserData(data: string) {
			set(ref(db, 'test/'), {
				test: data
			});
		}
		
		window.addEventListener("click", () => {
			writeUserData('data')
		})

The strange part that has lost me a bit of sleep is that this code initially worked – I was successfully sending data to the firebase db, but started getting this error after a few days after, without me making any changes to the code.

I thought it was something to do with my system/node/cli/dependencies, but no – tried it on my other computer and got the same result: worked initially → few days pass (made no changes) → started getting the error.

Does anyone have an idea what may be causing this? I think it’s something to do with getDatabase();

Thanks!