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

Client query_timeout leads to 400 invalid request error #126

Closed
ryancausey opened this issue Jun 28, 2023 · 2 comments · Fixed by #127
Closed

Client query_timeout leads to 400 invalid request error #126

ryancausey opened this issue Jun 28, 2023 · 2 comments · Fixed by #127

Comments

@ryancausey
Copy link

After upgrading to fauna-python v0.7.0, I am now getting the following error when setting a timeout in the client and making requests:

E                   fauna.errors.errors.InvalidRequestError: 400: invalid_request
E                   Invalid header 'x-query-timeout-ms': Invalid number '5000.0'.

The client instantiation code is:

def create_fauna_client(secret):
    """Create the FQLv10 client and return it.

    This should be called handler, or subsequently invoked functions within the handler,
    so when the lambda context is frozen, the socket connections are not lost.

    See: https://docs.fauna.com/fauna/current/drivers/known_issues
    """
    logger.debug("Initializing FaunaDB client.")
    # This timeout is currently set to half of the configured lambda timeout value. If
    # the terraform code is updated, this should be revisited.
    client = Client(secret=secret, query_timeout=timedelta(seconds=5))
    logger.debug("FaunaDB client initialized.")
    return client
@ptpaterson
Copy link
Contributor

Thanks for reporting. #124 should have fixed that. Looking into it!

@ptpaterson
Copy link
Contributor

Probably missed wrapping in int here, when the query_timeout is provided through client config.

self._query_timeout_ms = query_timeout.total_seconds() * 1000

@ryancausey We will get this updated. In the meantime, you should be to apply the query_timeout in the client.query method as a workaround.

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 a pull request may close this issue.

2 participants