Skip to content
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

Session token is not obtained automatically #36

Open
philippolis opened this issue Mar 10, 2023 · 2 comments
Open

Session token is not obtained automatically #36

philippolis opened this issue Mar 10, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@philippolis
Copy link
Collaborator

devtools::load_all()
#Loading DataToMetabase
mc <- MetabaseClient()
mc$get_databases()

Working with Posit Cloud and the metabase.citizensforeurope.org instance, this yields the following error:

Error: invalid assignment for reference class field ‘session’, should be from class “character” or a subclass (was class “NULL”)

Looking at mc, the user and password were read successfully from .Renviron, however, session is indeed NULL.

Reference class object of class "MetabaseClient"
Field "user":
[1] "(anonymized)"
Field "password":
[1] "(anonymized)"
Field "metabase_url":
[1] "https://metabase.citizensforeurope.org/"
Field "session":
[1] ""
Field "api_uri_prefix":
[1] "/api"

Here, the documentation says "session: Object of class character Session token, which is obtained automatically."

@KonradUdoHannes KonradUdoHannes added the bug Something isn't working label Mar 10, 2023
@KonradUdoHannes
Copy link
Collaborator

I'm not sure how sensitive the request library is with respect to double slashes, but the issue might be with metabase_url. The base url is actually "https://metabase.citizensforeurope.org", i.e. without the "/" at the end.

Nonetheless the error is still a little strange, because if the request fetching the session token fails, this should actually raise the corresponding request error. The error that you got suggests that the request somehow succeeded, but did not have the expected content, i.e. no session token. On the other hand it does happen regularly that websites do not return the request status that one would expect.

@KonradUdoHannes
Copy link
Collaborator

The trailing "/" seems to have been the cause of the issue. However, I'll leave the issue open for now as we might be able to make a better warning or similar to help users with this type of issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants