这是indexloc提供的服务,不要输入任何密码
Skip to content

accesing hasura session from custom function fails #3576

@tafelito

Description

@tafelito

I tried to follow the steps to create a custom function and access the hasura session variables from here and there are 2 issues

1- if you track the function from the console, when you execute the query it complains about not having the arguments variable

2- in order to get the session variables, I tracked the function through the API and then I get this error

{
  "errors": [
    {
      "extensions": {
        "internal": {
          "statement": "WITH \"public_get_session_role__result\" AS (SELECT  *  FROM \"public\".\"get_session_role\"()       ) SELECT  coalesce(json_agg(\"root\" ), '[]' ) AS \"root\" FROM  (SELECT  row_to_json((SELECT  \"_1_e\"  FROM  (SELECT  \"_0_root.base\".\"result\" AS \"result\"       ) AS \"_1_e\"      ) ) AS \"root\" FROM  (SELECT  *  FROM \"public_get_session_role__result\" WHERE ('true')     ) AS \"_0_root.base\"      ) AS \"_2_root\"      ",
          "prepared": true,
          "error": {
            "exec_status": "FatalError",
            "hint": "No function matches the given name and argument types. You might need to add explicit type casts.",
            "message": "function public.get_session_role() does not exist",
            "status_code": "42883",
            "description": null
          },
          "arguments": [
            "(Oid 114,Just (\"{\\\"x-hasura-role\\\":\\\"admin\\\",\\\"x-hasura-user-id\\\":\\\"15169bf8-294a-49cb-9d48-13a39a8c016e\\\"}\",Binary))"
          ]
        },
        "path": "$",
        "code": "unexpected"
      },
      "message": "postgres query error"
    }
  ]
}

I'm using hasura v1.0.0

Metadata

Metadata

Assignees

Labels

c/serverRelated to servere/quickfixcan be wrapped up in few hoursk/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions