Open
Description
Description
DataConnect returns a misleading error message.
Consider this:
I've got a schema defined in my schema.gql
that has a unique table constraint:
type Friendship @table(key: ["self", "companion"]) @unique(fields: ["self", "companion"]) {
self: User! @ref
friend: User! @ref
...
}
Now if I run this mutation once it works as expected:
mutation AddFriendToUser($userId: UUID!, $companion: UUID!) @auth(level: PUBLIC) {
companionship_insert(data: {
self: { id: $userId },
companion: { id: $companion }
})
}
But if I run the mutation again with exact same parameters it fails as expected but the error message here is really bad:
11.7.1 - [FirebaseDataConnect][I-FDC000000] executeMutation(): <private> grpc call
FAILED with {DataConnectOperationError, message: nil, underlyingError:
Optional(Swift.DecodingError.valueNotFound(Swift.Dictionary<Swift.String, Any>,
Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "companionship_insert", intValue: nil)],
debugDescription: "Cannot get keyed decoding container -- found null value instead", underlyingError: nil)))}.
I would expect to see something like unique constraint failed
Reproducing the issue
- Create a table with a unique table constraint
- Enter some data
- Enter that same data again
- You'll see the misleading output as noted above
Firebase SDK Version
11.13
Xcode Version
16.4
Installation Method
Swift Package Manager
Firebase Product(s)
Data Connect
Targeted Platforms
iOS
Relevant Log Output
11.7.1 - [FirebaseDataConnect][I-FDC000000] executeMutation(): <private> grpc call FAILED with {DataConnectOperationError, message: nil, underlyingError: Optional(Swift.DecodingError.valueNotFound(Swift.Dictionary<Swift.String, Any>, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "companionship_insert", intValue: nil)], debugDescription: "Cannot get keyed decoding container -- found null value instead", underlyingError: nil)))}.
If using Swift Package Manager, the project's Package.resolved
Expand Package.resolved
snippet
{
"originHash" : "3c96009dcd530476aeaedb7788fe6eab484640410a4f06f1e1593d468bfda3cc",
"pins" : [
{
"identity" : "abseil-cpp-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/abseil-cpp-binary.git",
"state" : {
"revision" : "bbe8b69694d7873315fd3a4ad41efe043e1c07c5",
"version" : "1.2024072200.0"
}
},
{
"identity" : "app-check",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "61b85103a1aeed8218f17c794687781505fbbef5",
"version" : "11.2.0"
}
},
{
"identity" : "confettiswiftui",
"kind" : "remoteSourceControl",
"location" : "https://github.com/simibac/ConfettiSwiftUI",
"state" : {
"revision" : "79666d42b882bf7921b1941fa7c636d681d77980",
"version" : "2.0.3"
}
},
{
"identity" : "data-connect-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/data-connect-ios-sdk",
"state" : {
"revision" : "9ff6f432f04cc8b793ddd59e430a11639a06c23c",
"version" : "11.7.1"
}
},
{
"identity" : "firebase-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk",
"state" : {
"revision" : "3663b1aa6c7a1bed67ee80fd09dc6d0f9c3bb660",
"version" : "11.13.0"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "543071966b3fb6613a2fc5c6e7112d1e998184a7",
"version" : "11.13.0"
}
},
{
"identity" : "googledatatransport",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleDataTransport.git",
"state" : {
"revision" : "617af071af9aa1d6a091d59a202910ac482128f9",
"version" : "10.1.0"
}
},
{
"identity" : "googleutilities",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "60da361632d0de02786f709bdc0c4df340f7613e",
"version" : "8.1.0"
}
},
{
"identity" : "grpc-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/grpc-binary.git",
"state" : {
"revision" : "cc0001a0cf963aa40501d9c2b181e7fc9fd8ec71",
"version" : "1.69.0"
}
},
{
"identity" : "grpc-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/grpc/grpc-swift.git",
"state" : {
"revision" : "07123ed731671e800ab8d641006613612e954746",
"version" : "1.23.1"
}
},
{
"identity" : "gtm-session-fetcher",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/gtm-session-fetcher.git",
"state" : {
"revision" : "4d70340d55d7d07cc2fdf8e8125c4c126c1d5f35",
"version" : "4.4.0"
}
},
{
"identity" : "hangman",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ArabicCompanion/Hangman",
"state" : {
"revision" : "919222c3d5b1335aebe0a0df7c29f7733c8309a4",
"version" : "1.2.12"
}
},
{
"identity" : "interop-ios-for-google-sdks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/interop-ios-for-google-sdks.git",
"state" : {
"revision" : "040d087ac2267d2ddd4cca36c757d1c6a05fdbfe",
"version" : "101.0.0"
}
},
{
"identity" : "leveldb",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/leveldb.git",
"state" : {
"revision" : "a0bc79961d7be727d258d33d5a6b2f1023270ba1",
"version" : "1.22.5"
}
},
{
"identity" : "mixpanel-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mixpanel/mixpanel-swift",
"state" : {
"revision" : "c550cbef7654e59d06bf9c224ea25f681dea8975",
"version" : "4.4.0"
}
},
{
"identity" : "nanopb",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/nanopb.git",
"state" : {
"revision" : "b7e1104502eca3a213b46303391ca4d3bc8ddec1",
"version" : "2.30910.0"
}
},
{
"identity" : "promises",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/promises.git",
"state" : {
"revision" : "540318ecedd63d883069ae7f1ed811a2df00b6ac",
"version" : "2.4.0"
}
},
{
"identity" : "purchases-ios-spm",
"kind" : "remoteSourceControl",
"location" : "https://github.com/RevenueCat/purchases-ios-spm.git",
"state" : {
"revision" : "96545bf014ca3d5a2b0ffd2c8de7105ca0705a19",
"version" : "5.22.0"
}
},
{
"identity" : "rive-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/rive-app/rive-ios",
"state" : {
"revision" : "05de329e3140dbe5772a0390521dc1c99b459d87",
"version" : "6.8.2"
}
},
{
"identity" : "sentry-cocoa",
"kind" : "remoteSourceControl",
"location" : "https://github.com/getsentry/sentry-cocoa/",
"state" : {
"revision" : "930b78a63f47549c81e6e63c9172584f7d3dfdd6",
"version" : "8.52.1"
}
},
{
"identity" : "sstoastmessage",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SimformSolutionsPvtLtd/SSToastMessage.git",
"state" : {
"revision" : "cd0a4499feca70c7255ad1287da49df42a1bcde0",
"version" : "2.0.0"
}
},
{
"identity" : "swift-algorithms",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-algorithms",
"state" : {
"revision" : "87e50f483c54e6efd60e885f7f5aa946cee68023",
"version" : "1.2.1"
}
},
{
"identity" : "swift-atomics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics.git",
"state" : {
"revision" : "cd142fd2f64be2100422d658e7411e39489da985",
"version" : "1.2.0"
}
},
{
"identity" : "swift-clocks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-clocks",
"state" : {
"revision" : "cc46202b53476d64e824e0b6612da09d84ffde8e",
"version" : "1.0.6"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "671108c96644956dddcd89dd59c203dcdb36cec7",
"version" : "1.1.4"
}
},
{
"identity" : "swift-concurrency-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-concurrency-extras",
"state" : {
"revision" : "82a4ae7170d98d8538ec77238b7eb8e7199ef2e8",
"version" : "1.3.1"
}
},
{
"identity" : "swift-http-structured-headers",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-http-structured-headers.git",
"state" : {
"revision" : "f280fc7676b9940ff2c6598642751ea333c6544f",
"version" : "1.2.2"
}
},
{
"identity" : "swift-http-types",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-http-types",
"state" : {
"revision" : "a0a57e949a8903563aba4615869310c0ebf14c03",
"version" : "1.4.0"
}
},
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log.git",
"state" : {
"revision" : "3d8596ed08bd13520157f0355e35caed215ffbfa",
"version" : "1.6.3"
}
},
{
"identity" : "swift-nio",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "6e17bc946821e550b88d22fd964423f70f1ce42d",
"version" : "2.82.0"
}
},
{
"identity" : "swift-nio-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-extras.git",
"state" : {
"revision" : "f1f6f772198bee35d99dd145f1513d8581a54f2c",
"version" : "1.26.0"
}
},
{
"identity" : "swift-nio-http2",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-http2.git",
"state" : {
"revision" : "4281466512f63d1bd530e33f4aa6993ee7864be0",
"version" : "1.36.0"
}
},
{
"identity" : "swift-nio-ssl",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-ssl.git",
"state" : {
"revision" : "6df102a39c8da5fdc2eae29a0f63546d660866fc",
"version" : "2.30.0"
}
},
{
"identity" : "swift-nio-transport-services",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-transport-services.git",
"state" : {
"revision" : "cd1e89816d345d2523b11c55654570acd5cd4c56",
"version" : "1.24.0"
}
},
{
"identity" : "swift-numerics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-numerics.git",
"state" : {
"revision" : "e0ec0f5f3af6f3e4d5e7a19d2af26b481acb6ba8",
"version" : "1.0.3"
}
},
{
"identity" : "swift-protobuf",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git",
"state" : {
"revision" : "d72aed98f8253ec1aa9ea1141e28150f408cf17f",
"version" : "1.29.0"
}
},
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system.git",
"state" : {
"revision" : "a34201439c74b53f0fd71ef11741af7e7caf01e1",
"version" : "1.4.2"
}
},
{
"identity" : "swiftcsvparser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SergioB-dev/SwiftCSVParser",
"state" : {
"revision" : "217e257c831b61e43963910397b9f73fab5bb616",
"version" : "0.3.0"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "39de59b2d47f7ef3ca88a039dff3084688fe27f4",
"version" : "1.5.2"
}
}
],
"version" : 3
}