Skip to content

Conversation

@aronatkins
Copy link
Contributor

@aronatkins aronatkins commented Oct 28, 2025

Replaces #1244; it contains additional details.

Given these changes, deployment to a "new" Connect Snowflake deployment succeeds.

rsconnect::addServer(
  "https://ENDPOINT.snowflakecomputing.app/",
  name = "connect-snowflake",
  snowflakeConnectionName = "CONNECTION-NAME"
)

rsconnect::connectSPCSUser(
  server = "connect-snowflake",
  apiKey = "CONNECT_API_KEY",
  snowflakeConnectionName = "connect-snowflake"
)

rsconnect::deployApp(server = "connect-snowflake")

costrouc and others added 4 commits October 28, 2025 11:21
SPCS (Snowpark Container Services) deployments require a dual
authentication model:
- Snowflake tokens provide proxied authentication to reach the server
- API keys identify the user to the Connect server itself

Changes:
- Updated authHeaders() to include X-RSC-Authorization header when both
  snowflakeToken and apiKey are present
- Added apiKey parameter to connectSPCSUser() function
- Updated getSPCSAuthedUser() to accept and use apiKey
- Store apiKey in account registration alongside snowflakeConnectionName
- Updated function documentation to explain the dual authentication model
- Added comprehensive test coverage for API key handling

This aligns with updated Connect server requirements for Snowflake SPCS
deployments and mirrors the authentication pattern in rsconnect-python.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Document the addition of API key support for SPCS authentication,
including the breaking change to connectSPCSUser() which now requires
an apiKey parameter.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Member

@costrouc costrouc left a comment

Choose a reason for hiding this comment

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

Successfully tested publishing externally into Snowflake

> remotes::install_github("rstudio/rsconnect@aron-snowflake-double-auth")
> rsconnect::addServer(
+   "https://..........snowflakecomputing.app/",
+   name = "connect-snowflake",
+   snowflakeConnectionName = "......."
+ )
! Both connections.toml and config.toml exist. Using connections.toml.
Server 'connect-snowflake' added successfully: https://..........snowflakecomputing.app/__api__
> rsconnect::connectSPCSUser(
+   server = "connect-snowflake",
+   apiKey = "TrV.......fkJ",
+   snowflakeConnectionName = "...."
+ )
! Both connections.toml and config.toml exist. Using connections.toml.
✔ Registered account for server: connect-snowflake / username: CHRIS.OSTROUCHOV@POSIT.CO
> rsconnect::deployApp("simple-quarto/hello.qmd", server = "connect-snowflake")
✔ Successfully deployed to <https://........snowflakecomputing.app/content/47a8dea5-......-36bccc0ce86e/>

@aronatkins aronatkins merged commit f0938ee into main Oct 28, 2025
12 checks passed
@aronatkins aronatkins deleted the aron-snowflake-double-auth branch October 28, 2025 21:34
@aronatkins aronatkins requested a review from edavidaja October 28, 2025 21:35
@aronatkins
Copy link
Contributor Author

@edavidaja - added you as a reviewer just so you're aware of these changes.

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.

3 participants