-
Notifications
You must be signed in to change notification settings - Fork 0
Fix duplicate pending invite on create #48
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BUILD-1102 Duplicate pending invite error
quick grab when reviewing this log Here's a longer log stack from today, 2025-08-27: <-- POST /api/v1/groups
[INFO] 🔗 Creating XMTP group for: Gardeners on ETH with first member: 0x003071A21787a07896a7259336FA6B014a9C689F
🏗️ Creating XMTP group with 1 members...
♻️ Reusing existing XMTP client for production environment
🔍 Address 0x003071A21787a07896a7259336FA6B014a9C689F → InboxId: a8874642e7095abe0ad1b378855924f618413631c01ce4d083391d8bd18c363d
✅ Converted 1 addresses to 1 inboxIds
🎉 XMTP group created successfully with ID: db24399e1672a3abdc731f8e50fcdb7d
🔒 Setting group permissions to admin-only for member addition...
✅ Group permissions updated: Only admins can add new members
🎯 Group setup complete: Agent is super admin, all members (including founders) are regular members
[INFO] ✅ XMTP group created successfully with ID: db24399e1672a3abdc731f8e50fcdb7d
[INFO] Processing 5 initial members for group: fea5db61-c231-446b-a484-bb068d11ac3c
📤 Sending message to XMTP group: db24399e1672a3abdc731f8e50fcdb7d
🔍 Looking up XMTP group: db24399e1672a3abdc731f8e50fcdb7d
♻️ Reusing existing XMTP client for production environment
group in getXmtpGroupById Group { ... }
🔍 Address 0x5222a9739DB4283298f16AA713555F7DFf08eEf2 → InboxId: 450af8422f52a0bba6cb9e905570be64eef01560f62d6aaa519b7860a8d7c625
stream: [Function: stream],
updateDescription: [AsyncFunction: updateDescription],
lastMessage: [AsyncFunction: lastMessage],
removeSuperAdmin: [AsyncFunction: removeSuperAdmin],
publishMessages: [AsyncFunction: publishMessages],
✅ Message sent successfully to group db24399e1672a3abdc731f8e50fcdb7d: be97ae5596652e383fac9a87b161056cbda17e4a03064cf28244cc68b37b8574
permissions: [Getter],
id: [Getter],
sendOptimistic: [Function: sendOptimistic],
[INFO] ✅ Welcome message sent successfully to group db24399e1672a3abdc731f8e50fcdb7d
updatePermission: [AsyncFunction: updatePermission],
isActive: [Getter],
send: [AsyncFunction: send],
✅ Checked 1 addresses for XMTP capability
admins: [Getter],
messages: [AsyncFunction: messages],
📊 Address 0x5222a9739DB4283298f16AA713555F7DFf08eEf2 analysis: inboxId=true, canMessage=true
lastMessage: [AsyncFunction: lastMessage],
➕ Adding 1 members to XMTP group: db24399e1672a3abdc731f8e50fcdb7d
addAdmin: [AsyncFunction: addAdmin],
consentState: [Getter],
consentState: [Getter],
🔍 Looking up XMTP group: db24399e1672a3abdc731f8e50fcdb7d
superAdmins: [Getter],
updateConsentState: [Function: updateConsentState],
♻️ Reusing existing XMTP client for production environment
removeAdmin: [AsyncFunction: removeAdmin],
updateConsentState: [Function: updateConsentState],
isAdmin: [Function: isAdmin],
messageDisappearingSettings: [Function: messageDisappearingSettings],
group in getXmtpGroupById Group { ... }
stream: [Function: stream],
✅ Found XMTP group: db24399e1672a3abdc731f8e50fcdb7d
publishMessages: [AsyncFunction: publishMessages],
[INFO] ➕ Adding member to existing XMTP group: Gardeners on ETH (db24399e1672a3abdc731f8e50fcdb7d)
sendOptimistic: [Function: sendOptimistic],
removeMessageDisappearingSettings: [AsyncFunction: removeMessageDisappearingSettings],
isMessageDisappearingEnabled: [Function: isMessageDisappearingEnabled],
pausedForVersion: [Function: pausedForVersion],
getHmacKeys: [Function: getHmacKeys],
debugInfo: [AsyncFunction: debugInfo],
}
✅ Found XMTP group: db24399e1672a3abdc731f8e50fcdb7d
🔍 Address 0x5222a9739DB4283298f16AA713555F7DFf08eEf2 → InboxId: 450af8422f52a0bba6cb9e905570be64eef01560f62d6aaa519b7860a8d7c625
✅ Converted 1 addresses to 1 inboxIds
🎉 Successfully added 1 members to group db24399e1672a3abdc731f8e50fcdb7d
[INFO] 🎉 Successfully added member 0x5222a9739DB4283298f16AA713555F7DFf08eEf2 to XMTP group db24399e1672a3abdc731f8e50fcdb7d
[INFO] ✅ Added initial member: aac1dddb-e3e6-4973-aa5c-97a7d97f85ec to group: fea5db61-c231-446b-a484-bb068d11ac3c
📤 Sending message to XMTP group: db24399e1672a3abdc731f8e50fcdb7d
🔍 Looking up XMTP group: db24399e1672a3abdc731f8e50fcdb7d
♻️ Reusing existing XMTP client for production environment
group in getXmtpGroupById Group { ... }
✅ Found XMTP group: db24399e1672a3abdc731f8e50fcdb7d
[INFO] ➕ Adding member to existing XMTP group: Gardeners on ETH (db24399e1672a3abdc731f8e50fcdb7d)
✅ Message sent successfully to group db24399e1672a3abdc731f8e50fcdb7d: f9efb469e81cdbf63b9b0e6fb242fdb3a930584143e2023d7420894d60fcfae7
[INFO] ✅ Welcome message sent for spengrah.eth in group db24399e1672a3abdc731f8e50fcdb7d
✅ Checked 1 addresses for XMTP capability
🔍 Address 0xA921790a528280c9E8d670E2171D527564C5cb13 → InboxId: 9810737df94ad712374e76458cef4344e9751b886bfdb607ad845732d86df511
📊 Address 0xA921790a528280c9E8d670E2171D527564C5cb13 analysis: inboxId=true, canMessage=true
➕ Adding 1 members to XMTP group: db24399e1672a3abdc731f8e50fcdb7d
🔍 Looking up XMTP group: db24399e1672a3abdc731f8e50fcdb7d
♻️ Reusing existing XMTP client for production environment
group in getXmtpGroupById Group { ... }
[INFO] ✅ Welcome message sent for j-p in group db24399e1672a3abdc731f8e50fcdb7d
stream: [Function: stream],
publishMessages: [AsyncFunction: publishMessages],
🔍 Address 0xc30b214D7a5b831676C845b1C728911D576e52eA → InboxId: b36c4d7f36689e4bbd285764719ffa340ca98873a1f0cc316292d89dd7eb3f13
sendOptimistic: [Function: sendOptimistic],
📊 Address 0xc30b214D7a5b831676C845b1C728911D576e52eA analysis: inboxId=true, canMessage=true
send: [AsyncFunction: send],
➕ Adding 1 members to XMTP group: db24399e1672a3abdc731f8e50fcdb7d
messages: [AsyncFunction: messages],
}
🔍 Looking up XMTP group: db24399e1672a3abdc731f8e50fcdb7d
lastMessage: [AsyncFunction: lastMessage],
✅ Found XMTP group: db24399e1672a3abdc731f8e50fcdb7d
consentState: [Getter],
♻️ Reusing existing XMTP client for production environment
lastMessage: [AsyncFunction: lastMessage],
🔍 Address 0xc30b214D7a5b831676C845b1C728911D576e52eA → InboxId: b36c4d7f36689e4bbd285764719ffa340ca98873a1f0cc316292d89dd7eb3f13
removeAdmin: [AsyncFunction: removeAdmin],
updateConsentState: [Function: updateConsentState],
group in getXmtpGroupById Group {
✅ Converted 1 addresses to 1 inboxIds
consentState: [Getter],
addSuperAdmin: [AsyncFunction: addSuperAdmin],
messageDisappearingSettings: [Function: messageDisappearingSettings],
permissions: [Getter],
🎉 Successfully added 1 members to group db24399e1672a3abdc731f8e50fcdb7d
name: [Getter],
updateMessageDisappearingSettings: [AsyncFunction: updateMessageDisappearingSettings],
removeSuperAdmin: [AsyncFunction: removeSuperAdmin],
updateConsentState: [Function: updateConsentState],
isAdmin: [Function: isAdmin],
[INFO] 🎉 Successfully added member 0xc30b214D7a5b831676C845b1C728911D576e52eA to XMTP group db24399e1672a3abdc731f8e50fcdb7d
removeMessageDisappearingSettings: [AsyncFunction: removeMessageDisappearingSettings],
updateName: [AsyncFunction: updateName],
♻️ Reusing existing XMTP client for production environment
updatePermission: [AsyncFunction: updatePermission],
isSuperAdmin: [Function: isSuperAdmin],
messageDisappearingSettings: [Function: messageDisappearingSettings],
[INFO] ✅ Added initial member: f49cbcee-0287-47bf-ab8f-ccf74620acda to group: fea5db61-c231-446b-a484-bb068d11ac3c
isMessageDisappearingEnabled: [Function: isMessageDisappearingEnabled],
imageUrl: [Getter],
updateMessageDisappearingSettings: [AsyncFunction: updateMessageDisappearingSettings],
addMembersByIdentifiers: [AsyncFunction: addMembersByIdentifiers],
admins: [Getter],
group in getXmtpGroupById Group {
📤 Sending message to XMTP group: db24399e1672a3abdc731f8e50fcdb7d
pausedForVersion: [Function: pausedForVersion],
🔍 Looking up XMTP group: db24399e1672a3abdc731f8e50fcdb7d
✅ Found XMTP group: db24399e1672a3abdc731f8e50fcdb7d
updateDescription: [AsyncFunction: updateDescription],
removeSuperAdmin: [AsyncFunction: removeSuperAdmin],
updateImageUrl: [AsyncFunction: updateImageUrl],
getHmacKeys: [Function: getHmacKeys],
🔍 Address 0xA921790a528280c9E8d670E2171D527564C5cb13 → InboxId: 9810737df94ad712374e76458cef4344e9751b886bfdb607ad845732d86df511
permissions: [Getter],
description: [Getter],
id: [Getter],
debugInfo: [AsyncFunction: debugInfo],
✅ Converted 1 addresses to 1 inboxIds
updatePermission: [AsyncFunction: updatePermission],
updateDescription: [AsyncFunction: updateDescription],
isActive: [Getter],
🎉 Successfully added 1 members to group db24399e1672a3abdc731f8e50fcdb7d
admins: [Getter],
addedByInboxId: [Getter],
[INFO] 🎉 Successfully added member 0xA921790a528280c9E8d670E2171D527564C5cb13 to XMTP group db24399e1672a3abdc731f8e50fcdb7d
superAdmins: [Getter],
[INFO] ✅ Added initial member: 42ed56bb-862d-438d-8ce0-8313c303e9de to group: fea5db61-c231-446b-a484-bb068d11ac3c
isAdmin: [Function: isAdmin],
createdAtNs: [Getter],
id: [Getter],
📤 Sending message to XMTP group: db24399e1672a3abdc731f8e50fcdb7d
addedByInboxId: [Getter],
consentState: [Getter],
isSuperAdmin: [Function: isSuperAdmin],
createdAt: [Getter],
sync: [AsyncFunction: sync],
🔍 Looking up XMTP group: db24399e1672a3abdc731f8e50fcdb7d
updateConsentState: [Function: updateConsentState],
isActive: [Getter],
addMembersByIdentifiers: [AsyncFunction: addMembersByIdentifiers],
createdAtNs: [Getter],
♻️ Reusing existing XMTP client for production environment
stream: [Function: stream],
messageDisappearingSettings: [Function: messageDisappearingSettings],
metadata: [AsyncFunction: metadata],
addMembers: [AsyncFunction: addMembers],
group in getXmtpGroupById Group { ... }
✅ Found XMTP group: db24399e1672a3abdc731f8e50fcdb7d
[INFO] ➕ Adding member to existing XMTP group: Gardeners on ETH (db24399e1672a3abdc731f8e50fcdb7d)
✅ Checked 1 addresses for XMTP capability
✅ Message sent successfully to group db24399e1672a3abdc731f8e50fcdb7d: ec6a04b2a209e46905c584ac1bb7180d44977a493ef49d32b08d94379c5ef5e8
isMessageDisappearingEnabled: [Function: isMessageDisappearingEnabled],
pausedForVersion: [Function: pausedForVersion],
getHmacKeys: [Function: getHmacKeys],
debugInfo: [AsyncFunction: debugInfo],
}
✅ Found XMTP group: db24399e1672a3abdc731f8e50fcdb7d
[INFO] 📮 Created pending XMTP invite for user 6433653f-d63c-4c1a-9bd3-96c489dc97b6 in group fea5db61-c231-446b-a484-bb068d11ac3c - no connected address
[INFO] ✅ Added initial member: 6433653f-d63c-4c1a-9bd3-96c489dc97b6 to group: fea5db61-c231-446b-a484-bb068d11ac3c
[ERROR] Error processing initial member 6433653f-d63c-4c1a-9bd3-96c489dc97b6: 65002 | async queryWithCache(queryString, params, query) {
65003 | if (this.cache === undefined || is(this.cache, NoopCache) || this.queryMetadata === undefined) {
65004 | try {
65005 | return await query();
65006 | } catch (e) {
65007 | throw new DrizzleQueryError(queryString, params, e);
^
error: Failed query: insert into "pending_invites" ("id", "group_id", "user_id", "status", "created_at", "updated_at") values (default, $1, $2, $3, default, default)
params: fea5db61-c231-446b-a484-bb068d11ac3c,6433653f-d63c-4c1a-9bd3-96c489dc97b6,pending
query: "insert into \"pending_invites\" (\"id\", \"group_id\", \"user_id\", \"status\", \"created_at\", \"updated_at\") values (default, $1, $2, $3, default, default)",
params: [
"fea5db61-c231-446b-a484-bb068d11ac3c", "6433653f-d63c-4c1a-9bd3-96c489dc97b6", "pending"
],
at queryWithCache (/app/dist/index.js:65007:38)
790 | }
791 | )
792 | Error.captureStackTrace(error, notSupported)
793 | return error
794 | }
^
PostgresError: duplicate key value violates unique constraint "unique_pending_invite_per_group"
severity_local: "ERROR",
severity: "ERROR",
detail: "Key (group_id, user_id)=(fea5db61-c231-446b-a484-bb068d11ac3c, 6433653f-d63c-4c1a-9bd3-96c489dc97b6) already exists.",
schema_name: "public",
table_name: "pending_invites",
constraint_name: "unique_pending_invite_per_group",
file: "nbtinsert.c",
routine: "_bt_check_unique",
code: "23505"
at ErrorResponse (/app/node_modules/postgres/src/errors.js:794:5)
✅ Message sent successfully to group db24399e1672a3abdc731f8e50fcdb7d: c7cd365e52f27571e55f89c038103de869f643366c3d7a8e199cfbc44bd91a98
[INFO] ✅ Welcome message sent for scottrepreneur.eth in group db24399e1672a3abdc731f8e50fcdb7d
[INFO] 📮 Created pending XMTP invite for user 3dba57eb-9314-4cc4-8065-abd2cbbc264b in group fea5db61-c231-446b-a484-bb068d11ac3c - no connected address
[INFO] ✅ Added initial member: 3dba57eb-9314-4cc4-8065-abd2cbbc264b to group: fea5db61-c231-446b-a484-bb068d11ac3c
[ERROR] Error processing initial member 3dba57eb-9314-4cc4-8065-abd2cbbc264b: 65002 | async queryWithCache(queryString, params, query) {
65003 | if (this.cache === undefined || is(this.cache, NoopCache) || this.queryMetadata === undefined) {
65004 | try {
65005 | return await query();
65006 | } catch (e) {
65007 | throw new DrizzleQueryError(queryString, params, e);
^
error: Failed query: insert into "pending_invites" ("id", "group_id", "user_id", "status", "created_at", "updated_at") values (default, $1, $2, $3, default, default)
params: fea5db61-c231-446b-a484-bb068d11ac3c,3dba57eb-9314-4cc4-8065-abd2cbbc264b,pending
query: "insert into \"pending_invites\" (\"id\", \"group_id\", \"user_id\", \"status\", \"created_at\", \"updated_at\") values (default, $1, $2, $3, default, default)",
params: [
"fea5db61-c231-446b-a484-bb068d11ac3c", "3dba57eb-9314-4cc4-8065-abd2cbbc264b", "pending"
],
at queryWithCache (/app/dist/index.js:65007:38)
790 | }
791 | )
792 | Error.captureStackTrace(error, notSupported)
793 | return error
794 | }
^
PostgresError: duplicate key value violates unique constraint "unique_pending_invite_per_group"
severity_local: "ERROR",
severity: "ERROR",
detail: "Key (group_id, user_id)=(fea5db61-c231-446b-a484-bb068d11ac3c, 3dba57eb-9314-4cc4-8065-abd2cbbc264b) already exists.",
schema_name: "public",
table_name: "pending_invites",
constraint_name: "unique_pending_invite_per_group",
file: "nbtinsert.c",
routine: "_bt_check_unique",
code: "23505"
at ErrorResponse (/app/node_modules/postgres/src/errors.js:794:5)
--> POST /api/v1/groups 201 2s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes BUILD-1102