@mahirmersimoski wrote:
Im trying to post an upload to a firebase but i get this error:
ERROR FirebaseError: Function FieldValue.arrayUnion() called with invalid data. Unsupported field value: undefined
at new n (http://localhost:8100/vendor.js:121742:23)
at t.Aa (http://localhost:8100/vendor.js:127978:16)
at t.Na (http://localhost:8100/vendor.js:128208:17)
at t.va (http://localhost:8100/vendor.js:128111:21)
at http://localhost:8100/vendor.js:128118:23
at k (http://localhost:8100/vendor.js:122576:68)
at t.ga (http://localhost:8100/vendor.js:128117:60)
at t.va (http://localhost:8100/vendor.js:128090:86)
at http://localhost:8100/vendor.js:128216:22
at Array.map ()This is the code and under createPost() there is the code that i get error on
import { Component, OnInit } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import {AngularFirestore} from '@angular/fire/firestore' import { UserService } from '../user.service'; import {firestore} from 'firebase/app' @Component({ selector: 'app-uploader', templateUrl: './uploader.page.html', styleUrls: ['./uploader.page.scss'], }) export class UploaderPage implements OnInit { imageURL: string desc: string constructor( public http: HttpClient, public afstore: AngularFirestore, public user:UserService ) { } ngOnInit() { } createPost(){ const image = this.imageURL const desc = this.desc this.afstore.doc(`users/${this.user.getUID()}`).update({ posts: firestore.FieldValue.arrayUnion({ image, desc }) }) }
Posts: 1
Participants: 1