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

In Firebase Functions iOS, a Cloud function error 'already-exists' gets treated as 'notFound' #9942

Closed
tciuro opened this issue Jun 24, 2022 · 5 comments · Fixed by #9955
Closed

Comments

@tciuro
Copy link
Contributor

tciuro commented Jun 24, 2022

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 13.4.1
  • Firebase SDK version: 9.3.0
  • Installation method: CocoaPods
  • Firebase Component: Functions
  • Target platform(s): iOS

[REQUIRED] Step 2: Describe the problem

Functions that throw already-exists generate the right HTTP response (seen in Postman as HTTP 409 Conflict). However, in the iOS client bubbles the error to the client as notFound. The commit mentioned below shows the affected areas and includes a fix.

Steps to reproduce:

Simple. Just throw the following from a Cloud Function:

throw new functions.https.HttpsError('already-exists', 'Resource exists')

If you have a downloadable sample project that reproduces the bug you're reporting, you will
likely receive a faster response on your issue.

Relevant Code:

https://github.com/firebase/firebase-ios-sdk/commit/3e758246f6c25001cb9f36ac9b429101a59219c7
@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.
@paulb777
Copy link
Member

Thanks for the report and suggested fix!

The error code problem is a regression from Firebase 8 to Firebase 9. The 409 processing looks like it has always been an issue. We'll follow up on a fix for 9.3.0.

@paulb777 paulb777 added this to the 9.3.0 - M118 milestone Jun 24, 2022
@paulb777
Copy link
Member

@tciuro Do you want to turn the fix into a PR to get the credit for the fix in the repo history?

@tciuro
Copy link
Contributor Author

tciuro commented Jun 27, 2022

I'd love to! Coming up. Thank you!

@tciuro
Copy link
Contributor Author

tciuro commented Jun 27, 2022

@firebase firebase locked and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants