Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "CollectionReference.add() requires its first argument to be of type object" when used with withConverter #2606

Closed
skflowne opened this issue Feb 7, 2020 · 1 comment · Fixed by #2607
Assignees

Comments

@skflowne
Copy link

skflowne commented Feb 7, 2020

Describe your environment

  • Operating System version: Windows 10
  • Browser version: Chrome 79
  • Firebase SDK version: 7.8.1
  • Firebase Product: database

Describe the problem

Using add on a CollectionReference built with withConverter throws an error when passing a custom class instance :
"[native Error Function CollectionReference.add() requires its first argument to be of type object, but it was: a custom Strategy object]"

The converter is only called if I pass a plain object, which seems to defeat the purpose of using a converter, unless I'm misunderstanding how this is supposed to work entirely

I'm encountering this in my Vue app and was able to reproduce it on CodeSandbox, link below

This seems similar to #2601

Relevant Code:

CodeSandbox

@thebrianchen
Copy link

@skflowne Thanks for reporting the bug! Currently working on a fix for this.

@firebase firebase locked and limited conversation to collaborators Mar 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
4 participants