Skip to content

connectcreds::connect_viewer_token() fails when current shiny session is a namespaced session (ie session_proxy) #6

Description

@bschulth

When using shiny::ns() in modules, connectcreds::connect_viewer_token() fails with:

Error:
! session must be a Shiny session object, not a <session_proxy> object.

The issue stems from:

  • https://github.com/posit-dev/connectcreds/blob/main/R/viewer-based-credentials.R#L197-L206

  • You can of course bypass this by rewriting your shiny module to pass the parent session into the module so that you have reference to the real shiny session object.

    • However, this does no good when using the odbc::databricks() driver because there is no way (that I can see) to pass any of the connectcreds::connect_viewer_token() arguments into the odbc package for it to use.

It's basically this error:

x = shiny::MockShinySession$new()$makeScope("test")
if (!missing(x) && inherits(x, "ShinySession")) {
    return(invisible(x))
}
rlang:::stop_input_type(
    x,
    "a Shiny session object"
)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions