Please help, I am frustrated by this for too long....
# prefect-community
Please help, I am frustrated by this for too long. I am still chasing my tail 🙈 I want to have GitHub Storage, however I still can't make it work, although I am doing nothing fancy.
Copy code = GitHub(repo="cividi/gemeinde_workflows",path="/workflows/",access_token_secret="GITHUB_ACCESS_TOKEN")
is stored in secret in Cloud. However, when I run flow through UI, I am still getting this and not sure why. Note: repository is private and own by our team, I am using token generated under my account. What I am missing? Thanks for your help in advance.
Hi @Karolína Bzdušek -- did you mean to attach an error?
Hm, this is indeed peculiar. You're certain the token has permissions for that repository and that it's set in Cloud under that key?
yes, this was one of things I checked, I think I even tried to generate some under team's account, same error
Your = Github(...)
code looks fine, it should work
Are you using a
Can you pass
--env GITHUB_ACCESS_TOKEN=<your-token>
and see if that works?
💯 1
yes, that's why I am not happpy about it. And yes,
The auth logic looks like this:
Copy code
if self.access_token_secret is not None:
            # If access token secret specified, load it
            access_token = Secret(self.access_token_secret).get()
            # Otherwise, fallback to loading from local secret or environment variable
            access_token = prefect.context.get("secrets", {}).get("GITHUB_ACCESS_TOKEN")
            if access_token is None:
                access_token = os.getenv("GITHUB_ACCESS_TOKEN")
Should help us narrow down where the issue is
then this is really weird, it should load it from Secrets
I'll try the pass
--env GITHUB_ACCESS_TOKEN=<your-token>
, I have to go to call now, write later.
Copy code
prefect agent local start  --env GITHUB_ACCESS_TOKEN=<token> --label <label1> --label <label2> --name "Local Agent"
And getting the very same log as before
Alright, thanks for checking that. One sec while I write up some code for a next step
Can you try the following with your token/repo?
Copy code
# Create a token at  <> with repo scope access
TOKEN = ""

# Set your repo name
REPO = "PrefectHQ/acsfas"

# Ensure you have python github installed
# - pip install PyGithub

from github import Github

client = Github(TOKEN)

You can use your existing token if you want, just want to ensure it works.
Copy code
Traceback (most recent call last):
  File "", line 178, in <module>
  File "/home/karolina/gemeinde_workflows/prefect/lib64/python3.8/site-packages/github/", line 345, in get_repo
    headers, data = self.__requester.requestJsonAndCheck(
  File "/home/karolina/gemeinde_workflows/prefect/lib64/python3.8/site-packages/github/", line 315, in requestJsonAndCheck
    return self.__check(
  File "/home/karolina/gemeinde_workflows/prefect/lib64/python3.8/site-packages/github/", line 340, in __check
    raise self.__createException(status, responseHeaders, output)
github.GithubException.UnknownObjectException: 404 {"message": "Not Found", "documentation_url": "<>"}
So unfortunately there is an issue with your token or repo name, not with the secret/Prefect.
or a bug in the PyGithub library, but that seems less likely
Then I'll dig into that, because repo exists, I have copied the name and token should work as well.🤷‍♀️ Thank for helping me out and your time.
Sorry 😕 perhaps try just using
or something to hit the API ( to ensure the token is functioning as expected and eliminate more variables.