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

[FR]Why does admin.send() return just the response name as error instead of the full response object #2693

Open
nero2009 opened this issue Sep 3, 2024 · 2 comments

Comments

@nero2009
Copy link

nero2009 commented Sep 3, 2024

Is your feature request related to a problem? Please describe.

I need to be able handle and cleanup tokens that have expired or are not working for whatever reason. I just migrated from sendToDevice to send and I was surprise that only a string response/error is returned when send is called.

Describe the solution you'd like

A response object that contains status, error code and message

similar to the return type of the now deprecated sendToDevice method

export interface FirebaseError {

code: string;

message: string;

stack?: string;

toJSON(): object;

}

Describe alternatives you've considered

There is no exhaustive list of all the error so there is no way for me to know when to remove expired token from my DB or keep them

Additional context

it is a bit wierd that other methods get a proper error object but send just gets a string error

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@nero2009
Copy link
Author

nero2009 commented Sep 4, 2024

False alarm because an Error object is returned but documentation can be improved

https://firebase.google.com/docs/reference/admin/node/firebase-admin.messaging.messaging.md#messagingsend

send returns an Error object on error.

Please update docs to show what the Error object is return when send fails

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants