Unauthorized FaunaDB with valid secret key in Python

Hi, I am having problem connecting to fauna db in python. It’s returning the error below

from faunadb import query as q
from faunadb.objects import Ref
from faunadb.client import FaunaClient
from dotenv import load_dotenv
import os

load_dotenv()

client = FaunaClient(secret=os.getenv("FAUNA_SECRET"),endpoint="https://db.us.fauna.com/")
client.query(q.create_collection({"name": "memes"})) 

client.query(
    q.create_index({
        "name": "id_index", 
        "source": q.collection("memes"),
        "terms": [{"field": ["data", "id"]}] 
    })
)

This is the error below


I will like to know what the problem is.

Hello @adejumoridwan and welcome! :wave:

The error indicates that your DNS server is unable to resolve the IP address for Fauna. To resolve the issue you can

  • Try to use a different DNS server. You clearly have an internet connection since you asked this question :slight_smile: but it is possible that your current DNS server is experiencing issues. You can try switching to a different DNS server such as Google DNS (8.8.8.8) or Cloudflare DNS (1.1.1.1).
  • Wait for a while and try again. DNS issues can sometimes be temporary.
  • Check if there are any network restrictions or firewalls that could be blocking Fauna.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.