Skip to content

fix: ssoCallback return format#3994

Open
ulemons wants to merge 3 commits intomainfrom
fix/logoUrl
Open

fix: ssoCallback return format#3994
ulemons wants to merge 3 commits intomainfrom
fix/logoUrl

Conversation

@ulemons
Copy link
Copy Markdown
Contributor

@ulemons ulemons commented Apr 2, 2026

Problem

When a new user logged in via SSO on a fresh database, the auth flow would create
a default tenant and trigger createProjectGroup, which internally called
createCollection without logoUrl, imageUrl, and color fields. Since the
SQL query referenced those parameters via pg-promise's $(field) syntax, their
absence caused pg-promise to throw, propagating the error all the way up to
ssoCallback.ts where it was caught and returned as a 401.

The issue was invisible in staging/prod because existing users already have a
tenant, so the createCollection code path is never hit on login.

Fix

Added explicit null defaults for logoUrl, imageUrl, and color before
passing the data object to the pg-promise query, so all expected parameters are
always present.


Note

Low Risk
Low risk, localized change to the createCollection insert parameters to avoid pg-promise missing-parameter errors; main impact is that omitted optional fields now persist as explicit NULL.

Overview
Fixes createCollection so inserts no longer fail when optional fields are omitted.

createCollection now builds a data object that pre-fills description, slug, logoUrl, imageUrl, and color with null before spreading the provided collection, ensuring all $(...) SQL parameters are always present for pg-promise.

Written by Cursor Bugbot for commit 29fdcd2. This will update automatically on new commits. Configure here.

@ulemons ulemons self-assigned this Apr 2, 2026
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@ulemons ulemons added the Bug Created by Linear-GitHub Sync label Apr 2, 2026
ulemons added 2 commits April 2, 2026 17:50
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
@ulemons ulemons marked this pull request as ready for review April 2, 2026 15:50
Copilot AI review requested due to automatic review settings April 2, 2026 15:50
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an SSO-login edge case where creating a default tenant could trigger createCollection with missing optional fields, causing pg-promise named-parameter formatting to throw and bubble up as an auth failure.

Changes:

  • Ensure logoUrl, imageUrl, and color parameters are always present (defaulting to null) when inserting a collection.
  • Pass the normalized insert params object to the pg-promise query instead of the raw collection input.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants