alreadyExists returns the wrong code#9955
alreadyExists returns the wrong code#9955paulb777 merged 1 commit intofirebase:masterfrom tciuro:master
Conversation
- is an alias for HTTP 409 Conflict. This can be confirmed via any HTTP query tool (e.g. Postman) - value "ALREADY_EXISTS" should return .alreadyExists, not .notFound.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Thanks @tciuro. Please fill out the CLA form. |
|
Submitted. Thanks Paul! |
|
Thanks Tito! Merged |
|
Hey @tciuro I'm working on Google Open Source Peer Bonus nominations and would like to recognize your contribution to improving Firebase Functions' code quality. I couldn't find an email address for you, so if you're interested, please email it to chliang at google.com and I'll make the nomination. |
|
Email sent. Thank you! |
As per @paulb777, here is the PR based on the issue I found: Fix #9942
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
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/3e758246f6c25001cb9f36ac9b429101a59219c7Regards,
-- Tito