Code Monkey home page Code Monkey logo

Comments (8)

brandongallagher1999 avatar brandongallagher1999 commented on June 15, 2024 1

I've identified some bugs, and am fixing them now. This is due to updates in the dependencies and not updating the code as a result. This is because I haven't touched this repo in many months at this point.

from cryptorrents-react-fastapi.

brandongallagher1999 avatar brandongallagher1999 commented on June 15, 2024 1

@rmdes With the new commit, (pushed directly to master, I know bad practice but I'm tired this morning), all issues related to react deps upgrade and docker have been fixed.

It will now run via a "docker-compose up" command. The only problem is the data the used to be returned to the front end as a table no (about a year ago) no longer returns anything as ThePirateBay changed their data tables and url pathing.

Unfortunately, when ThePirateBay makes a change to their frontend in production, it affects my app as it scrapes the website.

I ran my tests and you should be all good to go in terms of actually running it and seeing what the app would look like without TPB data.

a9ac888

from cryptorrents-react-fastapi.

brandongallagher1999 avatar brandongallagher1999 commented on June 15, 2024 1

That solution is already implemented into my code. As of why you're unable to request the backend via the front end is unknown to me. After cloning the repo, and running it with docker-compose, it seems to be working fine for me.

origins = ["http://localhost:3000"]

app.add_middleware(CORSMiddleware, allow_origins=origins, allow_methods=["*"], allow_headers=["*"])

from cryptorrents-react-fastapi.

brandongallagher1999 avatar brandongallagher1999 commented on June 15, 2024 1

As I said before in a previous comment, it won't return any results as ThePirateBay scraping library is broken since it wasn't updated to properly scrape their new front-end.

Unfortunately, when ThePirateBay makes a change to their frontend in production, it affects my app as it scrapes the website.

I ran my tests and you should be all good to go in terms of actually running it and seeing what the app would look like

without TPB data.

from cryptorrents-react-fastapi.

brandongallagher1999 avatar brandongallagher1999 commented on June 15, 2024

Hello Ricardo,

Is CORS-Anywhere a package more catered towards running servers? The back-end which is using CORS is running in FastAPI and I allow requests from localhost:3000. This might be a docker issue but I'll investigate that.

Also, I'll investigate this bug today and will get back to you with a reply.

from cryptorrents-react-fastapi.

rmdes avatar rmdes commented on June 15, 2024

Hello Brandon, thanks a lot for taking the time to update the code, I removed previous build images, pruned everything and built & composed-up with the latest code. Sadly I'm still getting the same issue

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:5000/api/torrents/?torrent=Dune. (Reason: CORS request did not succeed).

For testing purpose I connected to localhost:3000 using a tunneled ssh connection, when I do so, the CORS errors are gone but I can't get any results to display, probably something is wrong on my side but I'm getting out of ideas to have this running properly.

My stack is Debian 10 / Docker version 20.10.9, build c2ea9bc
frontend can be accessed from here : http://vmsdt-mendes.becode.org:3000/

I was thinking that maybe I could solve this by associating a proper hostname to the app, so I created a .env file
and specified a HOST and PUBLIC_URL like specified here https://create-react-app.dev/docs/advanced-configuration/
but it does not change anything

So I started to dig more about the issue between fastAPI and Cors and it seems
this could be a solution : tiangolo/fastapi#1663 (comment)
but I'm not sure (and I don't know enough about coding) if this relate to your code.

https://fastapi.tiangolo.com/tutorial/cors/

from cryptorrents-react-fastapi.

rmdes avatar rmdes commented on June 15, 2024

Sorry, I saw it was while exploring main.py from the backend folder after writing this comment ! my bad!

for the sake of testing I added my full hostname + port to the origin variable, built & run the containers
but I'm still stuck in the same situation (i'm running this on a Vsphere/Debian intranet)
I'm going to test this locally in my machine and if all run smooth this "issue" can be close :)

edit : for some reason the backend can't even "see" i'm accessing it from a "allowed" origin, even by declaring several origins
(localhost, hostname etc.) it still behave the same, I can only reach the conclusion it's a problem related to my intranet network.

from cryptorrents-react-fastapi.

rmdes avatar rmdes commented on June 15, 2024

For the sake of sharing information : I tested the CORS issue with a SSH Dynamic Port Forwarding
so when, locally I visit localhost:3000 it forwards the target to my ssh tunnel.

With this, when I request a search in the front end, I see the request hitting the backend server log
│ INFO: Started server process [1] │
│ INFO: Waiting for application startup. │
│ INFO: Application startup complete. │
│ INFO: Uvicorn running on http://0.0.0.0:5000 (Press CTRL+C to quit) │
│ INFO: 172.19.0.1:41216 - "OPTIONS /api/torrents/?torrent=Dune HTTP/1.1" 200 OK │
│ INFO: 172.19.0.1:41216 - "GET /api/torrents/?torrent=Dune HTTP/1.1" 200 OK

But, even though there is no more CORS issue using this approach, I don't get any results...

image

from cryptorrents-react-fastapi.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.