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

Error occurred when requesting STH-Comet with sth-source-operator from Wirecloud. #376

Open
fisuda opened this issue Feb 10, 2019 · 1 comment

Comments

@fisuda
Copy link
Contributor

fisuda commented Feb 10, 2019

Hi @aarranz Cc: @fgalan

I encountered Invalid cookie value error when requesting STH-Comet with sth-source-operator from Wirecloud.

Response received from STH:

response: "{"statusCode":400,"error":"Bad Request","message":"Invalid cookie value"}"

STH log:

time=2019-02-09T23:25:50.720Z | lvl=WARN | corr=c0a1a597-38f8-488b-b430-7848962341b7 | trans=c0a1a597-38f8-488b-b430-7848962341b7 | op=OPER_STH_GET | from=n/a | srv=test | subsrv=/ | comp=STH | msg=GET /STH/v1/contextEntities/type/Room/id/Room1/attributes/temperature?hLimit=30&hOffset=0, event={"request":"1549754750690:sth-comet:15:jry3yn1l:10000","timestamp":1549754750703,"tags":["state","error"],"data":{"header":"_ga=GA1.2.1613225138.1529842581, _csrf=CxfXpBBwOkX5NWWoxkOJyl1Z, _gid=GA1.2.2115011858.1549664031","errors":[{"name":"_ga","value":"GA1.2.1613225138.1529842581, _csrf=CxfXpBBwOkX5NWWoxkOJyl1Z, _gid=GA1.2.2115011858.1549664031","settings":{"strictHeader":true,"ignoreErrors":false,"isSecure":true,"isHttpOnly":true,"isSameSite":"Strict","path":null,"domain":null,"ttl":null,"encoding":"none"},"reason":"Invalid cookie value"}]},"internal":true}

I checked a request header which Wirecloud sent to STH. It seems that cookie is a cause of this error.

host : 127.0.0.1:8999
connection : close
user-agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
accept-encoding : gzip, deflate, br
accept : text/javascript, text/html, application/xml, text/xml, */*
x-real-ip : 192.168.11.70
x-forwarded-for : 192.168.11.70, 172.20.0.1
fiware-service : test
fiware-servicepath : /
x-requested-with : XMLHttpRequest
referer : https://mashup.lab.fisuda.jp/kz-suda/sth
accept-language : ja,en;q=0.9
via : 1.0 mashup.lab.fisuda.jp (Wirecloud-python-Proxy/1.1)
cookie : _ga=GA1.2.1613225138.1529842581, _csrf=CxfXpBBwOkX5NWWoxkOJyl1Z, _gid=GA1.2.2115011858.1549664031
  server.route([
    {
      method: 'GET',
      path: '/STH/v1/contextEntities/type/{entityType}/id/{entityId}/attributes/{attrName}',
      handler: sthGetDataHandler,
      config: {
        validate: {
          headers: sthHeaderValidator,
          query: {
            lastN: joi.number().integer().greater(-1).optional(),
            hLimit: joi.number().integer().greater(-1).optional(),
            hOffset: joi.number().integer().greater(-1).optional(),
            aggrMethod: joi.string().valid('max', 'min', 'sum', 'sum2', 'occur').optional(),
            aggrPeriod: joi.string().required().valid('month', 'day', 'hour', 'minute', 'second').optional(),
            dateFrom: joi.date().optional(),
            dateTo: joi.date().optional(),
            filetype: joi.string().optional(),
            count: joi.boolean().optional()
          }

        },
        state: {
           "parse": true,
           "failAction": "ignore"
        }
      }
    },

Thank you in advance.

@fgalan
Copy link

fgalan commented Feb 11, 2019

If the solution lays in STH side, we don't have any problem to introduce the new parameter. However, not sure if "ignore" is ok or it should be something taken from the configuration file and properly documented.

@aarranz what do you think?

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

2 participants