Giter Site home page Giter Site logo

Comments (9)

deleteLater avatar deleteLater commented on June 11, 2024

Hi @myskamartin, can you try

  • Run curl http://localhost:5001/health/liveness to make sure the API service is started successfully.
  • Check the API service logs, any exceptions?

And another thing I want to mention is that you only need to run the mongodb initialization script manually if you're using an external mongodb. The "built-in" mongodb in docker-compose is initialized automatically (see line 75)

mongodb:
image: mongo:5.0.14
restart: on-failure
ports:
- "27017:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=password
- MONGO_INITDB_DATABASE=featbit
volumes:
- mongodb:/data/db
- ./infra/mongodb/docker-entrypoint-initdb.d/:/docker-entrypoint-initdb.d/
networks:
- featbit-network

from featbit.

deleteLater avatar deleteLater commented on June 11, 2024

And to figure out why the preflight request fails, try the following command in bash:

curl -v 'http://localhost:5001/api/v1/user/has-multiple-workspaces' \
  -X 'OPTIONS' \
  -H 'Access-Control-Request-Headers: authorization,content-type,organization,workspace' \
  -H 'Access-Control-Request-Method: POST' \
  -H 'Origin: http://localhost:8081'

from featbit.

myskamartin avatar myskamartin commented on June 11, 2024

Hi @deleteLater, and thanks for your reply.

The API server has started successfully:

[root@ip-10-98-170-245 ~]# curl  http://localhost:5000/health/liveness
Healthy

I don't see any exception in the API logs that would raise my attention, everything looks in order.

But checking why the preflight request fails reveals the 204 No Content (full output below)

[root@ip-10-98-170-245 featbit]# curl -v 'http://localhost:5000/api/v1/user/has-multiple-workspaces' \
> -X 'OPTIONS' \
> -H 'Access-Control-Request-Headers: authorization,content-type,organization,workspace' \
> -H 'Access-Control-Request-Method: POST' \
> -H 'Origin: http://localhost:8081'
*   Trying 127.0.0.1:5000...
* Connected to localhost (127.0.0.1) port 5000> OPTIONS /api/v1/user/has-multiple-workspaces HTTP/1.1
> Host: localhost:5000
> User-Agent: curl/8.3.0
> Accept: */*
> Access-Control-Request-Headers: authorization,content-type,organization,workspace
> Access-Control-Request-Method: POST
> Origin: http://localhost:8081>
< HTTP/1.1 204 No Content
< Date: Fri, 29 Mar 2024 22:04:08 GMT
< Server: Kestrel
< Access-Control-Allow-Headers: authorization,content-type,organization,workspace
< Access-Control-Allow-Methods: POST
< Access-Control-Allow-Origin: *
<
* Connection #0 to host localhost left intact

Any further help is much appreciated.

FYI: I have started a new installation on Amazon Linux 2023 instance, thus I am no longer using port 5001

from featbit.

cosmic-flood avatar cosmic-flood commented on June 11, 2024

Try running the following script in mongodb and see what happens?

https://github.com/featbit/featbit/blob/main/infra/mongodb/docker-entrypoint-initdb.d/init.js

from featbit.

myskamartin avatar myskamartin commented on June 11, 2024

Hi @cosmic-flood,

Running the script will seed the database, but the issue remains and I don't see exceptions in the logs either.

from featbit.

deleteLater avatar deleteLater commented on June 11, 2024

The preflight request returns 204 indicating that there is no CORS issue. Our Api service has request logging enabled by default, so if you refresh your browser, you'll see a browser request log like this one. Can you see these logs?

If there are no such logs, means that the request did not reach to the Api service.

image

from featbit.

myskamartin avatar myskamartin commented on June 11, 2024

No, I don't see that in the logs at all.

I am a little bit confused. Given the docker-compose configuration and that I can reach the API container from the UI container, what else do I need to do to reach the API service?

Again, I am not changing the configuration at all to be clear on this one.

from featbit.

deleteLater avatar deleteLater commented on June 11, 2024

Ok, so the question is why requests sent from the browser are not reaching the API service. To be clear, the request was sent from the browser, not the UI service, so you need to make sure that you can access the API service from the machine that is accessing the UI.

For example, you run docker-compose on machine A and then access the UI from machine B, that's not gonna work. If that's your case, you need to update the environment variable "API_URL" to http://machine-A-host:5000

services:
ui:
image: featbit/featbit-ui:latest
environment:
- API_URL=http://localhost:5000
- DEMO_URL=https://featbit-samples.vercel.app
- EVALUATION_URL=http://localhost:5100
depends_on:
- api-server
ports:
- "8081:80"
networks:
- featbit-network

from featbit.

deleteLater avatar deleteLater commented on June 11, 2024

Close this issue as there is no further information. Feel free to reopen it if you have any questions. @myskamartin

from featbit.

Related Issues (20)

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.