score:8
Accepted answer
the solution was to import fieldvalue directly from the firebase package and not from the instantiated firebase app.
import firebase from 'firebase/app'
const arraytoupdate = firebase.firestore.fieldvalue.arrayunion(value)
score:0
it does seem like an issue with the way you're importing firebase.
my app is initialized as:
admin.initializeapp(functions.config().firestore);
i have an arrayunion when using it like this:
import * as admin from 'firebase-admin';
const firestoreadmin = admin;
const firestoreinstance = admin.firestore();
// example: admin.firestore.fieldvalue.arrayunion('entry-to-add'),
score:1
i believe since you are setting your initializeapp
to app
, you will instead want to use app.firestore.fieldvalue;
Source: stackoverflow.com
Related Query
- FieldValue is undefined
- React - uncaught TypeError: Cannot read property 'setState' of undefined
- ReactJS giving error Uncaught TypeError: Super expression must either be null or a function, not undefined
- TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined raised when starting react app
- React: "this" is undefined inside a component function
- Line 0: Parsing error: Cannot read property 'map' of undefined
- react router v^4.0.0 Uncaught TypeError: Cannot read property 'location' of undefined
- react evironment variables .env return undefined
- "this" is undefined inside map function Reactjs
- Error : Cannot read property 'map' of undefined
- 'Symbol' is undefined in IE after using babel
- React with ES7: Uncaught TypeError: Cannot read property 'state' of undefined
- Checking for Undefined In React
- Uncaught TypeError: Cannot read property 'push' of undefined (React-Router-Dom)
- React enzyme testing, Cannot read property 'have' of undefined
- Cannot read property 'history' of undefined (useHistory hook of React Router 5)
- React - TypeError: Cannot read property 'props' of undefined
- React-Router - Uncaught TypeError: Cannot read property 'getCurrentLocation' of undefined
- Getting Error Promise is undefined in IE11
- React this.props is undefined
- React.js - Can't read property of undefined
- Redux TypeError: Cannot read property 'apply' of undefined
- this.setState is undefined
- React Router: Cannot read property 'pathname' of undefined
- × TypeError: Cannot read properties of undefined (reading 'map')
- React-router TypeError: _this.props.history is undefined
- React + webpack: 'process.env' is undefined
- Nextjs: TypeError: unsupported file type: undefined after update to v.11
- Redux state is undefined in mapStateToProps
- React Typescript: Line 0: Parsing error: Cannot read property 'name' of undefined
More Query from same tag
- electron sending data from ipcMain to ipcRender
- document.location isn't working in ReactJS Production Build
- I can't apply the classes I get as variables while generating the react library
- Workaround for passing function to ipcMain and back using React, Redux, Electron
- I am trying to remove cookies in reactjs but it does not get removed
- How to declare multiple font-face and assign each of them to a variable and access them in styled-components
- How can I use dynamic Menu Component in next.js
- how to access from app component to my react reusable table cell data
- Re-render same component on url change in react
- How to use useEffect hook properly with array dependency. I passed state from redux store and still my component renders infinitely
- Cannot resolve module "firebase" from 'firebase.js' : Firebase could not be found within the project
- How to run production react app in local with local back-end
- Implementing a basic drag functionality in ReactJS
- How to access to a state in the render part with for loop?
- How to config minified React+ReactDOM with Webpack
- Could not find a declaration file for module 'tailwind-scrollbar'
- get name from a button click React
- React testing library: how to getByRole on custom role
- Material UI withStyles in an NPM package causes errors when used through npm link
- How can I change the checkbox styles and icons when hover on it in Material-UI React?
- Lazy loading SVG with CRA
- Children do not update on props change via Ref
- React state update produces wrong result
- can't resolve stripe - import axios from axios NEXTJS
- auth/invalid-email The email address is badly formatted
- Do function components have props in React?
- How to render component on click?
- How to pass a Json array of objects from a child class component to parent class component in React?
- Get selected multiple posts/pages by ID in Wordpress API using React/Javascript
- "setProps()" not triggering "useEffect" in Jest