JeremiahPetersen / RepoToText

Turn an entire GitHub Repo into a single organized .txt file to use with LLM's (GPT-4, Claude Opus, Gemini, etc)
MIT License
421 stars 51 forks source link

CORS issue opon Submit #6

Open Ojself opened 3 months ago

Ojself commented 3 months ago

I use macos 14.4.1 (m2)

When I click Submit, the network request fail with status Cors Error (.POST -> /scrape)

JeremiahPetersen commented 3 months ago

Hi Ojself, thank you for raising this, and I have been running into this issue on some mac setups. Tomorrow I will try to figure out the blocker here. I will report back on a fix, and I apologize you are running into this issue! But it gives a chance to problem solve:)

Ojself commented 3 months ago

I tried to set the CORS config to allow all origins, as well as allowing for OPTIONS in the /scrape route instead of just having POST but with no luck. I'm not too familiar with CORS but if I had to guess it has something to do with the preflight from the browser that flask doesn't like.

mmkostov commented 3 months ago
{
    "message": "Request failed with status code 500",
    "name": "AxiosError",
    "stack": "AxiosError: Request failed with status code 500\n    at settle (http://localhost:3000/static/js/bundle.js:42857:12)\n    at XMLHttpRequest.onloadend (http://localhost:3000/static/js/bundle.js:41517:66)\n    at Axios.request (http://localhost:3000/static/js/bundle.js:42018:41)\n    at async handleSubmit (http://localhost:3000/static/js/bundle.js:67:22)",
    "config": {
        "transitional": {
            "silentJSONParsing": true,
            "forcedJSONParsing": true,
            "clarifyTimeoutError": false
        },
        "adapter": [
            "xhr",
            "http"
        ],
        "transformRequest": [
            null
        ],
        "transformResponse": [
            null
        ],
        "timeout": 0,
        "xsrfCookieName": "XSRF-TOKEN",
        "xsrfHeaderName": "X-XSRF-TOKEN",
        "maxContentLength": -1,
        "maxBodyLength": -1,
        "env": {},
        "headers": {
            "Accept": "application/json, text/plain, */*",
            "Content-Type": "application/json"
        },
        "method": "post",
        "url": "http://localhost:5000/scrape",
        "data": "{\"repoUrl\":\"REPO\",\"docUrl\":\"\",\"selectedFileTypes\":[\".ts\",\".tsx\"]}"
    },
    "code": "ERR_BAD_RESPONSE",
    "status": 500
}

I'm also getting this error.

JeremiahPetersen commented 3 months ago

@mmkostov Hi Martin, what os are you running? Thank you for sharing the error output. This is helpful, and it seems to be the same or a similar issue.

mmkostov commented 3 months ago

@mmkostov Hi Martin, what os are you running? Thank you for sharing the error output. This is helpful, and it seems to be the same or a similar issue.

I'm on openSUSE TW. This seems to be a recent issue since it worked a few weeks before.

JeremiahPetersen commented 3 months ago

ah thank you Martin for letting me know this! I was wondering if it had to do with MacOS, but it seems it is affecting all (edit* some) users. I will find and fix this after work today. (within 10-12 hours of this message)

JeremiahPetersen commented 3 months ago

I am having trouble duplicating this issue. Currently it works for me, I am on a windows 10 pc. I am going to try running it on Linux Mint, and then will try replicating this on virtual env's. I am currently unsure why some users are experiencing issues on it but will keep investigating. -- I re cloned the repo, added a .env with my GITHUB_API_KEY='i put my key here' -- everything is working for me. Can anyone having the issue try creating a new GitHub API key and see if that makes any difference? @Ojself @mmkostov . thank you for your patience on this RepoToTextWorking

itsthemoon commented 3 months ago

I am facing the same issue. I generated a new API key but still the error persists. I am running this on a M1 mac

JeremiahPetersen commented 3 months ago

Hi @itsthemoon, thank you for the feedback. currently there are known issues with Mac unfortunately (the other issue thread opened) I have been pouring over stack overflow and forums trying to find a fix for the the issue Mac users are facing. If you don't mind, would you be able to share your error output?

mmkostov commented 3 months ago

I am having trouble duplicating this issue. Currently it works for me, I am on a windows 10 pc. I am going to try running it on Linux Mint, and then will try replicating this on virtual env's. I am currently unsure why some users are experiencing issues on it but will keep investigating. -- I re cloned the repo, added a .env with my GITHUB_API_KEY='i put my key here' -- everything is working for me. Can anyone having the issue try creating a new GitHub API key and see if that makes any difference? @Ojself @mmkostov . thank you for your patience on this RepoToTextWorking

I updated it, generated a new API key and now everything's working fine for me. Thanks for the help and patience :)