Skip to content

fix(ENG-12551): add x-hub-session-token header to connection attempt requests#139

Merged
adefreitas merged 1 commit into
StackOneHQ:mainfrom
adefreitas:ENG-12551/add-hub-session-token-to-connection-attempts
Apr 16, 2026
Merged

fix(ENG-12551): add x-hub-session-token header to connection attempt requests#139
adefreitas merged 1 commit into
StackOneHQ:mainfrom
adefreitas:ENG-12551/add-hub-session-token-to-connection-attempts

Conversation

@adefreitas

@adefreitas adefreitas commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add x-hub-session-token header to all connection attempt requests (create, poll, cancel)
  • Add token to dependency arrays of callbacks that use it

Context

Now that connection attempts are under /hub/, CloudFront uses the x-hub-session-token header for regional routing. Without this header, requests can't be routed to the correct backend.

Test plan

  • Verify connection attempt create/poll/cancel work end-to-end
  • Verify CloudFront routes requests to the correct region

🤖 Generated with Claude Code


Summary by cubic

Add the x-hub-session-token header to connection attempt create/poll/cancel requests under /hub so CloudFront routes to the correct region and polls/cancels stop failing. This enables the ENG-12551 server-side polling flow to work reliably in embedded scenarios.

  • Bug Fixes
    • Include x-hub-session-token in create, poll, and cancel requests; updated query helpers to accept a token.
    • Pass token through hooks and add it to callback dependency arrays to avoid stale headers.
    • After a successful poll, post an AccountConnected event to the parent window to keep embeds in sync.

Written for commit 6baa96f. Summary will update on new commits.

Move from /connect_sessions/connection_attempts to
/hub/connection_attempts to leverage CloudFront's existing
CORS handling for /hub/ paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 16, 2026 20:47

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@adefreitas adefreitas merged commit 73ca0b8 into StackOneHQ:main Apr 16, 2026
7 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds CloudFront routing support for /hub/connection_attempts by ensuring all connection-attempt requests include the x-hub-session-token header, and updates React callback dependencies/call sites accordingly.

Changes:

  • Add x-hub-session-token header to connection attempt create/poll/cancel requests.
  • Update pollConnectionAttempt / cancelConnectionAttempt signatures to accept token and update all call sites.
  • Add token to relevant hook callback dependency arrays; emit AccountConnected to the parent on polling-based success.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/modules/integration-picker/queries.ts Adds x-hub-session-token header to connection-attempt HTTP requests; updates function signatures for poll/cancel.
src/modules/integration-picker/hooks/useIntegrationPicker.ts Passes token into poll/cancel calls, updates hook dependencies, and posts AccountConnected to the parent when polling succeeds.

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

Comment on lines +559 to +564
parent.postMessage(
{
type: EventType.AccountConnected,
account: { id: result.account.id, provider },
},
'*',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants