Skip to content

custom_token isn't being passed to child Spotter workers #13

Open

Description

@g-mo

When using custom_token to initialize SofarApi, the custom token does not get passed into the Spotter workers. The Spotter workers will then each create their own instance of SofarApi that uses the WF_API_TOKEN environment variable, possibly resulting in failed queries due to using a wrong or missing token

Activity

  1. pieterbartsmit commented on Jul 28, 2022

    @pieterbartsmit
    Contributor

    @g-mo this is a rather tricky issue it seems. It is not always obvious when a new instance of the connection class gets created, and when the updated token needs to be passed.

    From a user perspective- I am inclined to not tie a token to an object instance, but make it a global property instead. The case where you would want to have multiple connections with different keys seems somewhat niche- and it seems more intuitive to me that once a User sets a new Token - the get_token function just returns that token.

    Complication is that currently tokens are also stored in the header parts of the sofarconnection objects, which would not automatically get updated on a change of state. Maybe adding the token to the header should be left to the point where we do a call to get/post etc.?

  2. pieterbartsmit commented on Jul 28, 2022

    @pieterbartsmit
    Contributor

    @tcj for visibility

  3. linked a pull request that will close this issueImprove token & custom token handling #45on Oct 4, 2024
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