Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Hussam Qasem
    @hussam-qasem

    Greetings!
    I put RESTHeart behind an Apache reverse proxy under a new location called /api. All tests including https://bo.mydomain.org/api/ping work as expected. However, when I try to access

    https://bo.mydomain.org/api/myBucket.files

    from a browser (other than Firefox), I get a 401 after entering the (admin/secret) username/password. The logs print:

    o.r.s.mechanisms.DigestAuthMechanism - The URI in digest token does not match the request URI

    I tried Chrome, Edge, Safari, all with 401. Firefox, curl, Postman work as expected.

    Do I need to do extra setup on RESTHeart to inform it of the new base_url https://bo.mydomain.org/api/ ?

    Thank you!

    Andrea Di Cesare
    @ujibang
    Hi @hussam-qasem , we double checked it and cannot replicate

    We configured mongo-mounts this way

    mongo-mounts:
      - what: /foo
        where: /api

    created a files bucket and uploaded there a file

    we then put the url in the browser http://localhost:8081/api/my.files/6176cdb7f3ccde248345ffa3/binary

    the browser login window pops up and providing the correct credentials, the browser display the file (in our test case it's an image)

    in the log we can spot
     17:38:34.769 [XNIO-1 task-1] DEBUG o.r.plugins.security.AuthMechanism - digestAuthMechanism -> AUTHENTICATED
    What I suspect is that your browser is using an old authentication digest token. You probably previously logged in with a different configuration?
    Hussam Qasem
    @hussam-qasem

    Hi @ujibang Thank you for the prompt response. I clear the browser cache between tests and use private / incognito modes. This is what I did. In my Apache conf file, I have a section that looks like:

    <VirtualHost bo.mydomain.org:443>
            ServerName bo.mydomain.org
    
            # SSL and other conf
    
            <Proxy balancer://restheart>
                    BalancerMember http://10.0.0.1:32111 route=route1 keepalive=On ping=1 ttl=60
                    ProxySet lbmethod=bytraffic
                    ProxySet stickysession=ROUTEID
            </Proxy>
    
            <Location /api>
                    ProxyPreserveHost On
                    RequestHeader set X-Forwarded-Proto expr=%{REQUEST_SCHEME}
                    ProxyPass balancer://restheart
            </Location>
    </VirtualHost>

    I run restheart as a Docker image, available on http://10.0.0.1:32111

    Like I said, curl, Postman, Firefox, all work as expected. Chrome and Edge seem to misbehave.

    Andrea Di Cesare
    @ujibang
    Hi @hussam-qasem , I'm not an expert of Apache as a reverse proxy, however I found this that seems related https://stackoverflow.com/questions/16375828/digest-uri-mismatch-with-proxy
    Hussam Qasem
    @hussam-qasem

    Hello. I'm loving the RESTHeart Container. I run it in a single-node Kubernetes cluster to play with. When I view the logs, I noticed that the logs are missing a date!

     11:50:38.504 [XNIO-1 task-2] INFO  org.restheart.handlers.RequestLogger - PUT http://api/test from /10.0.0.1:52431 => status=401 elapsed=1ms contentLength=0

    When viewing the console from within the DashboardUI, I see the date:

     2021-12-06T11:50:38.504764642+03:00 11:50:38.504 [XNIO-1 task-2] INFO  org.restheart.handlers.RequestLogger - PUT http://api/test from /10.0.0.1:52431 => status=401 elapsed=1ms contentLength=0

    So I'm guessing the ansi / control sequence are preventing the date from being printed.

    Do you have the same issue when running in a container? Do you have a suggestion to fix the issue? Thank you!!

    Andrea Di Cesare
    @ujibang

    the pattern of the log messages has been always

    <pattern>%d{HH:mm:ss.SSS} [%thread] %highlight(%-5level) %logger{36} - %msg%n %throwable{short}</pattern>

    so without the date

    @hussam-qasem if you want to change it you can specify a custom LogBack configuration following instructions at https://restheart.org/docs/logging/#specify-a-custom-logback-configuration
    John DiMiceli
    @jdimi_gitlab
    Using GraphQL with Restheart. GraphQL types Int, Float, and String all fail to serialize mongodb type BsonInt64. I see support for BsonInt64 was added to Restheart v6.0.0. How do I specify a GraphQL schema type that will solve this? I understand the problem might not be with Restheart, but with GraphQL.
    Andrea Di Cesare
    @ujibang
    John DiMiceli
    @jdimi_gitlab
    Thanks! I will check out Decimal128 as a possible solution
    John DiMiceli
    @jdimi_gitlab
    Decimal128 suffers from the same fate. Returns "Expected type 'Decimal128' but was 'BsonInt64'
    Andrea Di Cesare
    @ujibang
    We need to add a new type. It's quite simple and will add to next release....
    If you add a issue on github it will help!
    Andrea Di Cesare
    @ujibang

    H @jdimi_gitlab I double checked, I think that you can use graphql type Long to map mongodb type BsonInt64

    see https://github.com/SoftInstigate/restheart/blob/master/graphql/src/main/java/org/restheart/graphql/scalars/bsonCoercing/GraphQLBsonInt64Coercing.java

    John DiMiceli
    @jdimi_gitlab
    Absent a creating a custom class copying the techniques of GraphQLBsonInt64Coercing.java, substituting Long for Int in the schema results in this error: "... GraphQLIllegalAppDefinitionException... The Field type 'Long' is not present when resolving type 'MyType'"
    Andrea Di Cesare
    @ujibang
    I pushed 8d6acdb that shouyld fix it . You can try the snapshot build. See how at https://github.com/SoftInstigate/restheart/blob/master/README.md#snapshot-builds
    Andrea Di Cesare
    @ujibang
    Urg build failed, will fix it tomorrow!
    Andrea Di Cesare
    @ujibang

    ok fixed @jdimi_gitlab . you can try 92b51be

    note: you need java 17 to run this snapshot release!

    With the following GraphQL app definition
    {
      "_id": "testLong",
      "descriptor": {
        "name": "TestLong",
        "description": "GraphQL App to test Long scalar",
        "enabled": true,
        "uri": "testLong"
      },
      "schema": "type Test{  _id: ObjectId n: Long  } type Query { all: [Test] }",
      "mappings": {
        "Test": {
        },
        "Query": {
            "all": {
              "db": "restheart",
              "collection": "test"
            }
          }
      }
    }
    creating in the collection test documents like
    {
        "n": {
            "$numberLong": "2398239058230985"
        }
    }

    the following GraphQL request works as expected

    { all { _id n  } }

    reponse

    {
        "data": {
            "all": [
                {
                    "_id": {
                        "$oid": "61b8d1502b29d754e337350c"
                    },
                    "n": 2
                },
                {
                    "_id": {
                        "$oid": "61b8d1512b29d754e337350f"
                    },
                    "n": 2
                },
                {
                    "_id": {
                        "$oid": "61b8d1632b29d754e3373514"
                    },
                    "n": 2
                },
                {
                    "_id": {
                        "$oid": "61b8d16c2b29d754e3373518"
                    },
                    "n": 2398239058230985
                },
                {
                    "_id": {
                        "$oid": "61b9b25bbb8a4542b608c7ea"
                    },
                    "n": 2398239058230985
                }
            ]
        }
    John DiMiceli
    @jdimi_gitlab
    Thanks! Don't know if I'll be able to use your snapshot, but care to predict when the next versioned release will have it?
    Andrea Di Cesare
    @ujibang
    @jdimi_gitlab se will release the fix by next week
    Andrea Di Cesare
    @ujibang
    @jdimi_gitlab we added a more complete description of the GraphQL/Bson types mapping at https://restheart.org/docs/graphql/#bson-types
    the Long-> BsonInt64 mapping will be in 6.1.5 (out very soon)
    Andrea Di Cesare
    @ujibang
    6.1.5 is out!
    Harald Wiesinger
    @s3ppo
    @ujibang i heard about the log2shell security problem for java software.. is this relevant to restheart? ;)
    Andrea Di Cesare
    @ujibang
    No, RESTHeart does not use Log4j
    🍾
    Harald Wiesinger
    @s3ppo
    🎉🥳🥳
    Andrea Di Cesare
    @ujibang
    @jdimi_gitlab we found a bug in 6.1.5, going to release 6.1.6 soon. Please update!
    Maurizio Turatti
    @mkjsix
    Maurizio Turatti
    @mkjsix
    henczi-espirit
    @henczi-espirit

    Hello all. I am Nico from e-Spirit and I have a question:
    I wanted to know which query parameters do NOT have the form ?key=value (so for example ?count or ?np). For this I tried to find in the documentation some kind of list of all possible query parameters. Unfortunately I had no success with it. Is there such a list?

    Additionally, I noticed that ?count and ?np no longer exist in the current v6 documentation. I haven't looked through all the release notes yet, but I guess this means that these parameters are deprecated?

    Thanks in advance.
    I hope you had a good start into the new year.

    Ghost
    @ghost~61d5c9a96da03739848db0c8

    Hello everyone,

    I have a simple question, but cannot figure a way out to work. I would like to use RESTHeart with docker and connect to a remote database. However, I don’t really know how to do so.

    In the default.properties file I change the mongo-uri and root-mongo-resource. I tried to connect to a local database running on localhost and to a hosted database on DigitalOcean, neither works. Do I have to change anything else?

    Maurizio Turatti
    @mkjsix
    if you look at the docs at https://hub.docker.com/r/softinstigate/restheart
    3) Run a RESTHeart container
    
    docker run -d --rm --network restheart-network -p "8080:8080" -e MONGO_URI="mongodb://mongodb" softinstigate/restheart
    2 replies
    so you need to pass the MONGO_URI
    if you are running with docker-compose you just need to edit the MONGO_URI environment variable in the docker-compose.yml (https://raw.githubusercontent.com/SoftInstigate/restheart/master/docker-compose.yml)
    11 replies
    Alternatively you need to run the docker container mounting a docker volume overriding the restheart.propeties file, the local one is immutable
    Maurizio Turatti
    @mkjsix
    @tolbri if you have issues with this let us know
    Andrea Di Cesare
    @ujibang
    image.png

    hi @henczi-espirit , the query parameters that don't require a value (although you can actually set one as in ?checkEtag equals to ?checkEtag=whatever) are: ?checkEtag, ?count and ?np

    Note that HAL representation is deprecated (in favour of standard representation, see https://restheart.org/docs/representation-format/#other-representation-formats).

    1 reply
    HAL and SHAL are deprecated in version 6.0 and will likely be removed in a future release.
    Andrea Di Cesare
    @ujibang

    hi @tolbri , we have updated the documentation. http://127.0.0.1:4000/docs/setup/#run-with-docker

    If you want to run RESTHeart with docker and have MongoDB running on localhost you can just run the following command

    $ docker run -it --rm -p "8080:8080" -e MONGO_URI='mongodb://host.docker.internal' softinstigate/restheart