Database: setValue hangs when data contains some invalid keys
Description
When DatabaseReference.setValue is passed data that contains a key with a non-printable ascii character, or a key that exceeds the 768 byte limit, the function does not throw an error and never returns.
Expected: The function throws an error when encountering these invalid keys.
Reproducing the issue
Key with a non-printable ascii character:
do {
try await ref.setValue(["\n": "value"])
print("This is never printed")
} catch {
print("This is never printed")
}
Similarly with a long key:
do {
try await ref.setValue([String(repeating: "a", count: 800): "value"])
print("This is never printed")
} catch {
print("This is never printed")
}
Firebase SDK Version
9.6.0
Xcode Version
14.0.1
Installation Method
Swift Package Manager
Firebase Product(s)
Database
Targeted Platforms
iOS
Relevant Log Output
No response
If using Swift Package Manager, the project's Package.resolved
Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Change back
Change back