firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.69k stars 1.48k forks source link

FunctionsError: UserInfo are not set on the returned NSError for 'internal' error status #11376

Closed vpusher closed 1 year ago

vpusher commented 1 year ago

Description

Reading at the implementation here, I discovered there is no way we can parse the error details (nor the message) returned by a callable for the internal status code. There is a specific if statement that skips de deserialization.

Is that on purpose ? If yes, could you explain why ?

Returning any other status code than internal is okay to be able to parse the error details.

Reproducing the issue

In the Callable implementation just throw an HttpsError with internal status code, a message and some details payload like so:

functions.https.onCall(async (data, context) => {
   throw new functions.https.HttpsError('internal', 'my message', {foo: 'bar'});
...

NodeJS Cloud Function implementation.

On the iOS side, you will not be able to get either the message nor the details of that error in the error's userInfo.

Firebase SDK Version

10.9

Xcode Version

14.3

Installation Method

Swift Package Manager

Firebase Product(s)

Functions

Targeted Platforms

iOS

Relevant Log Output

No response

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
```json { "pins" : [ { "identity" : "abseil-cpp-binary", "kind" : "remoteSourceControl", "location" : "https://github.com/google/abseil-cpp-binary.git", "state" : { "revision" : "a5f16ba68913840ee5df91b8dc06f5cc063579de", "version" : "1.2021110200.0" } }, { "identity" : "cocoalumberjack", "kind" : "remoteSourceControl", "location" : "https://github.com/CocoaLumberjack/CocoaLumberjack.git", "state" : { "revision" : "80ada1f753b0d53d9b57c465936a7c4169375002", "version" : "3.7.4" } }, { "identity" : "firebase-ios-sdk", "kind" : "remoteSourceControl", "location" : "https://github.com/firebase/firebase-ios-sdk.git", "state" : { "revision" : "4961c0b7eb5d794e47a58dbfdd258b4beca4263a", "version" : "10.9.0" } }, { "identity" : "googleappmeasurement", "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleAppMeasurement.git", "state" : { "revision" : "9209b95a2593985569918e5e5ee2bf4ef8ff3640", "version" : "10.9.0" } }, { "identity" : "googledatatransport", "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleDataTransport.git", "state" : { "revision" : "5056b15c5acbb90cd214fe4d6138bdf5a740e5a8", "version" : "9.2.0" } }, { "identity" : "googleutilities", "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleUtilities.git", "state" : { "revision" : "871d43135925cde39ef7421d8723ce47edfdcc39", "version" : "7.11.1" } }, { "identity" : "grpc-binary", "kind" : "remoteSourceControl", "location" : "https://github.com/google/grpc-binary.git", "state" : { "revision" : "df37f6af8a273bc687e3166843ed86007de57d78", "version" : "1.44.0" } }, { "identity" : "gtm-session-fetcher", "kind" : "remoteSourceControl", "location" : "https://github.com/google/gtm-session-fetcher.git", "state" : { "revision" : "96d7cc73a71ce950723aa3c50ce4fb275ae180b8", "version" : "3.1.0" } }, { "identity" : "htp", "kind" : "remoteSourceControl", "location" : "https://github.com/vpusher/htp", "state" : { "revision" : "226a4cd2a322ddee2329b12f1b70cc636584e4aa", "version" : "0.9.3" } }, { "identity" : "leveldb", "kind" : "remoteSourceControl", "location" : "https://github.com/firebase/leveldb.git", "state" : { "revision" : "0706abcc6b0bd9cedfbb015ba840e4a780b5159b", "version" : "1.22.2" } }, { "identity" : "lightweightchartsios", "kind" : "remoteSourceControl", "location" : "https://github.com/tradingview/LightweightChartsIOS", "state" : { "revision" : "dc5b245798e13c32907576a8c2b9c458d6cf688a", "version" : "3.8.0" } }, { "identity" : "localconsole", "kind" : "remoteSourceControl", "location" : "https://github.com/duraidabdul/LocalConsole", "state" : { "revision" : "2c5d5e018acd4963fe6dfe858f6d6fecef7cbf2f", "version" : "1.12.1" } }, { "identity" : "lottie-spm", "kind" : "remoteSourceControl", "location" : "https://github.com/airbnb/lottie-spm.git", "state" : { "revision" : "c3852816c622ad35a03ed39c187c1644ece2382b", "version" : "4.1.3" } }, { "identity" : "nanopb", "kind" : "remoteSourceControl", "location" : "https://github.com/firebase/nanopb.git", "state" : { "revision" : "819d0a2173aff699fb8c364b6fb906f7cdb1a692", "version" : "2.30909.0" } }, { "identity" : "promises", "kind" : "remoteSourceControl", "location" : "https://github.com/google/promises.git", "state" : { "revision" : "3e4e743631e86c8c70dbc6efdc7beaa6e90fd3bb", "version" : "2.1.1" } }, { "identity" : "svgkit", "kind" : "remoteSourceControl", "location" : "https://github.com/SVGKit/SVGKit", "state" : { "revision" : "58152b9f7c85eab239160b36ffdfd364aa43d666", "version" : "3.0.0" } }, { "identity" : "swift-log", "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-log.git", "state" : { "revision" : "6fe203dc33195667ce1759bf0182975e4653ba1c", "version" : "1.4.4" } }, { "identity" : "swift-markdown-ui", "kind" : "remoteSourceControl", "location" : "https://github.com/gonzalezreal/swift-markdown-ui", "state" : { "revision" : "5e15c0d75e42b9840301503e0df681027d4bea05", "version" : "2.0.1" } }, { "identity" : "swift-protobuf", "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { "revision" : "fa0fcd43f272a260e7f734f23e6dc55e16fcae0a", "version" : "1.19.1" } }, { "identity" : "swifter", "kind" : "remoteSourceControl", "location" : "https://github.com/httpswift/swifter.git", "state" : { "revision" : "9483a5d459b45c3ffd059f7b55f9638e268632fd", "version" : "1.5.0" } }, { "identity" : "swiftui-introspect", "kind" : "remoteSourceControl", "location" : "git@github.com:siteline/SwiftUI-Introspect.git", "state" : { "revision" : "c18951c747ab62af7c15e17a81bd37d4fd5a9979", "version" : "0.2.3" } }, { "identity" : "swiftui-visual-effects", "kind" : "remoteSourceControl", "location" : "https://github.com/lucasbrown/swiftui-visual-effects", "state" : { "revision" : "b26f8cebd55ff60ed8953768aa818dfb005b5838", "version" : "1.0.3" } } ], "version" : 2 } ```

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
```yml Replace this line with the contents of your Podfile.lock! ```
google-oss-bot commented 1 year ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

paulb777 commented 1 year ago

This looks like a duplicate of #11310. See the discussion there and the associated PR #11311

cc: @taeold