Skip to content

Default client get secret from env vars limits compatibility with cloud runtimes #180

@zaklein

Description

@zaklein

Hi there :)

I'm trying to migrate from the faunadb to the fauna Python client. My specific use case involves running an automated process on a platform called Pipedream. I can't initiate the fauna Client, seemingly due to an issue related to the given runtime not supporting the attempt to retrieve the "FAUNA_SECRET" environment variable. To help set the context, here's the Python code I'm running in Pipedream:

from fauna.client import Client
db_client = Client(secret="abc") # actual key redacted

This is leading to the error message:

Traceback (most recent call last):

  File "/nano-py/pipedream/worker.py", line 137, in execute
    user_retval = handler(pd)
                  ^^^^^^^^^^^

  File "/tmp/__pdg__/dist/code/f3f82eb5747d9e59b7038eb7fc82c2dc2557fdccd09bbf910b13851e405e5b35/code.py", line 26, in handler
    db_client = Client(secret=db_secret)
                ^^^^^^^^^^^^^^^^^^^^^^^^

  File "/tmp/__pdg__/dist/python/fauna/client/client.py", line 94, in __init__
    self._set_endpoint(endpoint)

  File "/tmp/__pdg__/dist/python/fauna/client/client.py", line 574, in _set_endpoint
    endpoint = _Environment.EnvFaunaEndpoint()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/tmp/__pdg__/dist/python/fauna/client/utils.py", line 63, in __call__
    os.environ.get(

TypeError: dict.get() takes no keyword arguments

The same code works for me locally (same versions for Python and fauna), so it seems like a Pipedream runtime problem. It'd be great if we could control this default "FAUNA_SECRET" environment variable behaviour to extend the compatibility of fauna across runtime contexts. For example, something like:

client = Client(secret=db_secret, default_key_location=False)

Please let me know if you have any follow up questions.
Thanks very much,
Zach

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