Error 500 with liana/v3/permission

While I upgrade forest-express-sequelize I have a error with liana/v3/permissions

Expected behavior

Curl https://api.forestadmin.com/liana/v3/permissions?renderingId=60364 send a

{
  "errors": [
    {
      "status": 500,
      "detail": "[Fri May 07 2021 13:17:47 GMT+0000 (Coordinated Universal Time)] Unexpected Error"
    }
  ]
}

And I see this error on my log server

2021-05-07T13:10:57.243210+00:00 app[web.1]: e[31m[forest] 🌳🌳🌳  Permissions error: Forest server request error: Internal Server Errore[39m
2021-05-07T13:10:57.243228+00:00 app[web.1]: e[31m{e[39m
2021-05-07T13:10:57.243229+00:00 app[web.1]: e[31m  "jse_shortmsg": "Permissions error",e[39m
2021-05-07T13:10:57.243229+00:00 app[web.1]: e[31m  "jse_cause": {e[39m
2021-05-07T13:10:57.243230+00:00 app[web.1]: e[31m    "jse_shortmsg": "Forest server request error",e[39m
2021-05-07T13:10:57.243230+00:00 app[web.1]: e[31m    "jse_cause": {e[39m
2021-05-07T13:10:57.243231+00:00 app[web.1]: e[31m      "status": 500,e[39m
2021-05-07T13:10:57.243231+00:00 app[web.1]: e[31m      "response": {e[39m
2021-05-07T13:10:57.243231+00:00 app[web.1]: e[31m        "req": {e[39m
2021-05-07T13:10:57.243232+00:00 app[web.1]: e[31m          "method": "GET",e[39m
2021-05-07T13:10:57.243232+00:00 app[web.1]: e[31m          "url": "https://api.forestadmin.com/liana/v3/permissions?renderingId=60364",e[39m
2021-05-07T13:10:57.243233+00:00 app[web.1]: e[31m          "headers": {e[39m
2021-05-07T13:10:57.243252+00:00 app[web.1]: e[31m            "forest-secret-key": "b7605693d917b004ec3a4fb39e9ce4a50d407857e46ac094fdd534ed9bcc4115"e[39m
2021-05-07T13:10:57.243252+00:00 app[web.1]: e[31m          }e[39m
2021-05-07T13:10:57.243253+00:00 app[web.1]: e[31m        },e[39m
2021-05-07T13:10:57.243253+00:00 app[web.1]: e[31m        "header": {e[39m
2021-05-07T13:10:57.243254+00:00 app[web.1]: e[31m          "server": "Cowboy",e[39m
2021-05-07T13:10:57.243254+00:00 app[web.1]: e[31m          "connection": "close",e[39m
2021-05-07T13:10:57.243255+00:00 app[web.1]: e[31m          "x-dns-prefetch-control": "off",e[39m
2021-05-07T13:10:57.243255+00:00 app[web.1]: e[31m          "x-frame-options": "SAMEORIGIN",e[39m
2021-05-07T13:10:57.243255+00:00 app[web.1]: e[31m          "strict-transport-security": "max-age=15552000; includeSubDomains",e[39m
2021-05-07T13:10:57.243256+00:00 app[web.1]: e[31m          "x-download-options": "noopen",e[39m
2021-05-07T13:10:57.243256+00:00 app[web.1]: e[31m          "x-content-type-options": "nosniff",e[39m
2021-05-07T13:10:57.243256+00:00 app[web.1]: e[31m          "x-xss-protection": "1; mode=block",e[39m
2021-05-07T13:10:57.243257+00:00 app[web.1]: e[31m          "content-type": "application/json; charset=utf-8",e[39m
2021-05-07T13:10:57.243257+00:00 app[web.1]: e[31m          "content-length": "120",e[39m
2021-05-07T13:10:57.243257+00:00 app[web.1]: e[31m          "etag": "W/\"78-Nf5N+cfIDRfMAhDm40N4t5LPS60\"",e[39m
2021-05-07T13:10:57.243258+00:00 app[web.1]: e[31m          "vary": "Accept-Encoding",e[39m
2021-05-07T13:10:57.243258+00:00 app[web.1]: e[31m          "date": "Fri, 07 May 2021 13:10:57 GMT",e[39m
2021-05-07T13:10:57.243258+00:00 app[web.1]: e[31m          "via": "1.1 vegur"e[39m
2021-05-07T13:10:57.243259+00:00 app[web.1]: e[31m        },e[39m
2021-05-07T13:10:57.243259+00:00 app[web.1]: e[31m        "status": 500,e[39m
2021-05-07T13:10:57.243271+00:00 app[web.1]: e[31m        "text": "{\"errors\":[{\"status\":500,\"detail\":\"[Fri May 07 2021 13:10:57 GMT+0000 (Coordinated Universal Time)] Unexpected Error\"}]}"e[39m
2021-05-07T13:10:57.243272+00:00 app[web.1]: e[31m      }e[39m
2021-05-07T13:10:57.243272+00:00 app[web.1]: e[31m    },e[39m
2021-05-07T13:10:57.243272+00:00 app[web.1]: e[31m    "jse_info": {},e[39m
2021-05-07T13:10:57.243273+00:00 app[web.1]: e[31m    "message": "Forest server request error: Internal Server Error"e[39m
2021-05-07T13:10:57.243273+00:00 app[web.1]: e[31m  },e[39m
2021-05-07T13:10:57.243274+00:00 app[web.1]: e[31m  "jse_info": {}e[39m
2021-05-07T13:10:57.243274+00:00 app[web.1]: e[31m}e[39m

But it’s ok with liana/v2

curl https://api.forestadmin.com/liana/v2/permissions?renderingId=60364 it’s ok

I check and I correctly change my liana init

app.use(
    await Liana.init({
      configDir: path.join(__dirname, "../forest"),
      envSecret: process.env.FOREST_ENV_SECRET,
      authSecret: process.env.FOREST_AUTH_SECRET,
      objectMapping,
      connections,
    })
  );

Any idea ?

  • Package Version: “forest-express-sequelize”: “^7.0.0”,
  • Express Version: “express”: “~4.16.3”,
  • Sequelize Version: “sequelize”: “~5.15.1”
  • Database Dialect: PG
  • Database Version: “pg”: “~6.1.0”,
  • Project Name: Memorizer

Let me check your project…

ok thank for information its ok with my developpement environnement

I think the error is issued while getting the permissions for your charts, can you access your dashboards ?
If so, try to remake your charts, you have this issue because a while ago we changed how we linked collections to the charts and the object in your chart definition as collections ids that are integers whereas we now use strings.
Remaking your charts should solve your issue !

I ok for the permission error, but now it’s this environment I have all my data on timeout. Not case with development env on the same database :frowning:

No error ?
can you give me an endpoint that timeout pls ?

No error

Exemple: https://forestadminmemorizerstaging.herokuapp.com/forest/category/count?fields[category]=createdAt%2Cid%2Cimage%2Cname%2CupdatedAt%2Cdisplay%2CisOther%2CcategoryParent&fields[categoryParent]=name&searchExtended=0&timezone=Europe%2FParis

I see Cannot read property ‘renderingId’ of undefined

On your own server ?
Can you share a screenshot of the error so I can try to pinpoint it ?

2021-05-07T14:10:53.990287+00:00 app[web.1]: (node:23) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
2021-05-07T14:10:54.044068+00:00 app[web.1]: (node:23) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'renderingId' of undefined
2021-05-07T14:10:54.044069+00:00 app[web.1]:     at getRenderingIdFromUser (/app/node_modules/forest-express/dist/middlewares/permissions.js:29:15)
2021-05-07T14:10:54.044070+00:00 app[web.1]:     at _callee$ (/app/node_modules/forest-express/dist/middlewares/permissions.js:101:33)
2021-05-07T14:10:54.044071+00:00 app[web.1]:     at tryCatch (/app/node_modules/regenerator-runtime/runtime.js:63:40)
2021-05-07T14:10:54.044072+00:00 app[web.1]:     at Generator.invoke [as _invoke] (/app/node_modules/regenerator-runtime/runtime.js:293:22)
2021-05-07T14:10:54.044072+00:00 app[web.1]:     at Generator.next (/app/node_modules/regenerator-runtime/runtime.js:118:21)
2021-05-07T14:10:54.044072+00:00 app[web.1]:     at asyncGeneratorStep (/app/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
2021-05-07T14:10:54.044073+00:00 app[web.1]:     at _next (/app/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
2021-05-07T14:10:54.044073+00:00 app[web.1]:     at /app/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7
2021-05-07T14:10:54.044074+00:00 app[web.1]:     at new Promise (<anonymous>)
2021-05-07T14:10:54.044074+00:00 app[web.1]:     at /app/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12
2021-05-07T14:10:54.044075+00:00 app[web.1]:     at /app/node_modules/forest-express/dist/middlewares/permissions.js:130:23
2021-05-07T14:10:54.044075+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2021-05-07T14:10:54.044075+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/route.js:137:13)
2021-05-07T14:10:54.044076+00:00 app[web.1]:     at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
2021-05-07T14:10:54.044076+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2021-05-07T14:10:54.044077+00:00 app[web.1]:     at /app/node_modules/express/lib/router/index.js:281:22
2021-05-07T14:10:54.044077+00:00 app[web.1]:     at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2021-05-07T14:10:54.044077+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/index.js:275:10)
2021-05-07T14:10:54.044078+00:00 app[web.1]:     at Function.handle (/app/node_modules/express/lib/router/index.js:174:3)
2021-05-07T14:10:54.044078+00:00 app[web.1]:     at router (/app/node_modules/express/lib/router/index.js:47:12)
2021-05-07T14:10:54.044079+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2021-05-07T14:10:54.044079+00:00 app[web.1]:     at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13)
2021-05-07T14:10:54.044079+00:00 app[web.1]:     at /app/node_modules/express/lib/router/index.js:284:7
2021-05-07T14:10:54.044080+00:00 app[web.1]:     at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2021-05-07T14:10:54.044080+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/index.js:275:10)
2021-05-07T14:10:54.044081+00:00 app[web.1]:     at /app/node_modules/express/lib/router/index.js:635:15
2021-05-07T14:10:54.044081+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/index.js:260:14)
2021-05-07T14:10:54.044081+00:00 app[web.1]:     at Function.handle (/app/node_modules/express/lib/router/index.js:174:3)
2021-05-07T14:10:54.044082+00:00 app[web.1]:     at router (/app/node_modules/express/lib/router/index.js:47:12)
2021-05-07T14:10:54.044085+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2021-05-07T14:10:54.044086+00:00 app[web.1]:     at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13)
2021-05-07T14:10:54.044086+00:00 app[web.1]:     at /app/node_modules/express/lib/router/index.js:284:7
2021-05-07T14:10:54.044086+00:00 app[web.1]:     at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2021-05-07T14:10:54.044087+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/index.js:275:10)
2021-05-07T14:12:48.262854+00:00 app[web.1]: GET /forest/category/count?fields%5Bcategory%5D=createdAt%2Cid%2Cimage%2Cname%2CupdatedAt%2Cdisplay%2CisOther%2CcategoryParent&fields%5BcategoryParent%5D=name&searchExtended=0&timezone=Europe%2FParis - - - - ms
2021-05-07T14:12:48.260600+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/forest/category/count?fields%5Bcategory%5D=createdAt%2Cid%2Cimage%2Cname%2CupdatedAt%2Cdisplay%2CisOther%2CcategoryParent&fields%5BcategoryParent%5D=name&searchExtended=0&timezone=Europe%2FParis" host=forestadminmemorizerstaging.herokuapp.com request_id=83aa3b1b-3d3e-49c0-b779-4929a7fa3a36 fwd="92.170.115.222" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https

Timeout request

And the data/headers of the request ?
Seems like it tries to get the user from the request but it is undefined. Maybe try to logout and in again…

undefined is ok with the login / logout

But not the timeout

Timeout curl:

curl 'https://forestadminmemorizerstaging.herokuapp.com/forest/category/count?fields%5Bcategory%5D=createdAt%2Cid%2Cimage%2Cname%2CupdatedAt%2Cdisplay%2CisOther%2CcategoryParent&fields%5BcategoryParent%5D=name&searchExtended=0&timezone=Europe%2FParis' \
  -H 'Connection: keep-alive' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="90", "Google Chrome";v="90"' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjMzNzkyIiwiZW1haWwiOiJqb25hdGhhbi5qYWxvdXpvdEBtZW1vcml6ZXIuYWkiLCJmaXJzdE5hbWUiOiJKb25hdGhhbiIsImxhc3ROYW1lIjoiSkFMT1VaT1QiLCJ0ZWFtIjoiT3BlcmF0aW9ucyIsInJlbmRlcmluZ0lkIjo2MDM2NCwiaWF0IjoxNjIwMzk3MTYxLCJleHAiOjE2MjA0MDA3NjF9.Rfc7FIrRhqswbFtVUczBnEgEcclNmfcSqS5iPkAOyGg' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36' \
  -H 'Content-Type: application/json' \
  -H 'Origin: https://app.forestadmin.com' \
  -H 'Sec-Fetch-Site: cross-site' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Referer: https://app.forestadmin.com/' \
  -H 'Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7' \
  --compressed

Did the error change on your backend ?

Now I only have the timeout without error in my log. I check on development all it’s ok

You don’t have an error in your browser either ?
Are your charts displayed ?
It’s the same request ?
Without more info this will be hard to crack :grimacing:

I deleted all my chart. No error in my browser. It’s for all get request, I have a timeout

I find it’s the version of node. In my laptop it’s node 12 on staging node14.

And the project doesn’t work with this node.

Thank for your help

PS: I need to create a new user for post my reply (Big C…)

1 Like