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

CORS issue opon Submit #6

Open
Ojself opened this issue Apr 13, 2024 · 10 comments
Open

CORS issue opon Submit #6

Ojself opened this issue Apr 13, 2024 · 10 comments

Comments

@Ojself
Copy link

Ojself commented Apr 13, 2024

I use macos 14.4.1 (m2)

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

@JeremiahPetersen
Copy link
Owner

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
Copy link
Author

Ojself commented Apr 14, 2024

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
Copy link

{
    "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
Copy link
Owner

@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
Copy link

@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
Copy link
Owner

JeremiahPetersen commented Apr 15, 2024

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
Copy link
Owner

JeremiahPetersen commented Apr 15, 2024

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
Copy link

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
Copy link
Owner

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
Copy link

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 :)

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

No branches or pull requests

4 participants