Encountering an issue while trying to utilize the firestorePlugin from vuefire in Vuejs 3 createApp. The problem is that I am receiving an Uncaught TypeError: Cannot set property '$

I recently encountered an issue in my Vue.js 3 app with the following code snippet in my main.js file:

import { createApp } from "vue";
import App from "./App.vue";
import { firestorePlugin } from "vuefire";

const app = createApp(App);

app.use(firestorePlugin);

app.mount("#app");

It seems that using app.use(firestorePlugin); is causing errors. Without it, everything renders perfectly fine, but with it, I receive the following error message:

vuefire.esm.js?0ff2:619 Uncaught TypeError: Cannot set property '$unbind' of undefined
    at firestorePlugin (vuefire.esm.js?0ff2:619)
    at Object.use (runtime-core.esm-bundler.js?5c40:2949)
    at eval (main.js?56d7:9)
    at Module../src/main.js (app.js:1021)
    at __webpack_require__ (app.js:849)
    at fn (app.js:151)
    at Object.1 (app.js:1034)
    at __webpack_require__ (app.js:849)
    at checkDeferredModules (app.js:46)
    at app.js:925

On clicking the error, it reveals this specific line where it mentions Uncaught TypeError: Cannot set property '$unbind' of undefined:

 Vue.prototype[unbindName] = function firestoreUnbind(key, reset) {
        this._firestoreUnbinds[key](reset);
        delete this._firestoreUnbinds[key];
        delete this.$firestoreRefs[key];
    };

Additionally, here are my Firebase configurations stored in firebase.js:

import firebase from "firebase/app";
import "firebase/firestore";
import "firebase/auth";
import "firebase/storage";

const firebaseConfig = {
  apiKey: xxxxxxxxxxxxxxxxxxxxxxxx,
  authDomain: xxxxxxxxxxxxxxxxxxxxxxxx,
  projectId: xxxxxxxxxxxxxxxxxxxxxxxx,
  storageBucket: xxxxxxxxxxxxxxxxxxxxxxxx,
  messagingSenderId: xxxxxxxxxxxxxxxxxxxxxxxx,
  appId: xxxxxxxxxxxxxxxxxxxxxxxx,
};
firebase.initializeApp(firebaseConfig);

export const db = firebase.firestore();
export const auth = firebase.auth();
export const storage = firebase.storage();

Any assistance or guidance on resolving this issue would be greatly appreciated. Please feel free to reach out if you require any further information. Thank you!

Answer №1

If you visit the official VueFire website at , you will come across this important note:

Note: The current version of VueFire only supports Vue 2 and Firebase 7. However, support for Vue 3 / Composition API and Firebase 8 is in progress.

Therefore, it is recommended to uninstall the existing version and install the upcoming version by running the following commands:

 npm install vuefire@next firebase@next

Answer №2

It seems that there is no updated version of Vuefire available for the current versions of Vue (3) or Firebase (9), despite advice suggesting to "uninstall the current version and install the next version."

The most recent stable release ([email protected]) was made "one year ago" (May 2021) and, as noted in a February 2021 response here, states:

"This version currently supports Vue 2 and Firebase 7. Support for Vue 3 / Composition API and Firebase 8 is coming soon."

An alpha build ([email protected]) was also released "about one year ago" (approximately May 2021) and it states that it "currently works with Firebase 7. Updates for Firebase 8 are on their way."

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Merge arrays with identical names within the same object into one cohesive object containing all elements

I just started using Vue and I'm not entirely sure if it's possible to achieve what I have in mind. Here is the structure I have: { "items":[ { "total":1287, "currency":"USD", "name":"string", "itemID":"", "pro ...

Determine the precise x and y coordinates of a centered element using JQuery

How can I determine the exact left and top positions of an element? The parent container has text-align: center, causing potential confusion when there are multiple elements on the bottom row. For instance, the first one may have a position of 0px instea ...

Tips for incorporating strikethrough into a drop-down select box in a jquery datatable and implementing filtering based on it

In this scenario, I am currently utilizing a jQuery Datatable with strikethrough text. My aim is to make the filterable dropdown display the same strikethrough text; however, it is not displaying properly at the moment. Below is my jQuery datatable setup: ...

The window.open function is creating a new tab using the specified origin or URL

I have a button within an iframe on the webpage "loclahost:3000". When this button is clicked, it should open a new tab with the URL "www.google.com". However, instead of opening the desired URL, the new tab opens with the following incorrect URL: "http:// ...

Updating ng-table within an Angular controller

Having encountered an unusual issue with ng-table. Here is a snippet of code from my controller: this.category = "Open"; this.category = ["Open", "Accepted", "Rejected"]; this.dataItems = []; var _this = this; this.$scope.$watch("vm.category", function( ...

`VS grammar: The element with the tag `span` is not allowed to contain another element with

I have developed a custom Vue component that acts as a wrapper for applying a jQuery Select2 widget to a traditional HTML select element. Although everything is functioning correctly, Visual Studio has detected a grammatical issue with the way I have impl ...

Hide the background when the modal appears

I have successfully implemented a jQuery CustomBox modal on my website. However, I am facing an issue with hiding the content div behind the modal once it pops up. My goal is to make the content div reappear after the modal has been closed. You can view a ...

Sharing Axios Response Data in VueJS: A Guide for Parent-Child Component Communication

Can someone please help me with using VueJS and Axios to retrieve API data and pass it to multiple child components? I am trying to avoid accessing the API multiple times in the child components by passing the data through props. The issue I am facing is ...

Skrollr immediate pop-up notification

Can anyone help me figure out how to make text appear suddenly and then disappear using skrollr? I've been able to get it to fade in and out, but I want it to just show up without any transition. Here's the code I have so far: <div id="style" ...

IE8 is encountering a null JSON response from the HTTP handler, unlike IE10 and Chrome which are not experiencing this

Here is my JavaScript code snippet: patients.prototype.GetPatient = function(patient_id,callback) { var xmlhttp; var fullpath; try { if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { ...

Unable to connect Dropzone to dynamically loaded DIV using AJAX

Using Dropzone for client-side image uploads has been a breeze. Take a look at this basic example that is currently up and running: If you examine the source code, you'll notice that I am utilizing JQuery to connect Dropzone to the upload1 div ID. H ...

Steps for incorporating a variable into a hyperlink

I'm trying to achieve something similar to this: var myname = req.session.name; <------- dynamic <a href="/upload?name=" + myname class="btn btn-info btn-md"> However, I am facing issues with making it work. How can I properly ...

Bring the element into view by scrolling horizontally

I am facing a challenge with a list of floated left divs inside another div. This inner block of divs can be hovered over to move it left and right. Each inner div, known as 'events', has class names that include a specific year. Additionally, t ...

Tips on optimizing website performance by implementing lazy loading for images and ensuring they are ready for printing

Many websites feature an abundance of images, prompting the use of lazy loading to enhance load times and reduce data consumption. But what happens when printing functionality is also required for such a website? One approach could involve detecting the p ...

Require a hard refresh when running npm watch command

When I'm working with Laravel and Vue JS, I find myself relying heavily on the npm run watch command. However, whenever I make changes to my VUE template, I always have to manually refresh the browser by pressing Ctrl+Shift+R or enabling "Disable cac ...

Is there a way to detect when the escape key is pressed?

Is there a way to detect when the escape key is pressed in Internet Explorer, Firefox, and Chrome? I have code that works in IE and alerts 27, but in Firefox it alerts 0 $('body').keypress(function(e){ alert(e.which); if(e.which == 27){ ...

Create an interactive HTML5 drag-and-drop interface that restricts the dropping of nested elements to only within form fields. This functionality is achieved

I have implemented Sortable.JS in a form builder to enable drag and drop functionality. My goal is to allow users to drag sections (which is mostly working) and questions within those sections, either within the same section or into other sections. The is ...

Exploring an array using bluebird promises

I am currently facing an issue where I need to iterate over an array containing promises. My goal is to multiply all the values in the array by 2 and then return the updated array: var Bluebird = Promise.noConflict(); var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9 ...

Having trouble storing data in a MYSQL database with NodeJS and ReactJS

When trying to submit the form, a "Query Error" popup appears and data is not being saved in the database. API router.post("/add_customer", (req, res) => { const sql = `INSERT INTO customer (name, mobile, email, address, state, city, policytype, insu ...

Creating a JavaScript function to selectively blur elements while leaving one in focus

My goal is to blur all elements on a webpage except for the p#this tag using vanilla JavaScript. I am determined to learn the intricacies of JavaScript, so I'm not looking for solutions involving jQuery or CSS. I came across a potential solution on t ...