rentrop / serverless-postgraphql

Serverless GraphQL endpoint for PostgresSQL using AWS, serverless and PostGraphQL
MIT License
108 stars 11 forks source link

Trouble getting results #4

Closed jmparsons closed 7 years ago

jmparsons commented 7 years ago

I've followed the how to and am not able to get a good response. I can run the non serverless postgraphsql forum example just fine locally and query it using graphiql.

My pg connection after sls deploy looks like this:

"config": {
  "PGCON": "postgres://example:serverless@MY_PG_ENDPOINT:5432/forumexample"
},

And my YML:

environment:
  PGCON: postgres://example:serverless@MY_PG_ENDPOINT:5432/forumexample
  JWT_SECRET: keyboard_kitten

When I try to run graphiql using postgraphql-local or from the pgcon url using this query:

{
  postById(id: 3) {
    id
    headline
  }
}

yields:

{
  "errors": [
    {
      "message": "permission denied to set role \"forum_example_anonymous\""
    }
  ]
}

Same query with Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoxLCJiIjoyLCJjIjozfQ.hxhGCCCmGV9nT1slief1WgEsOsfdnlVizNrODxfh1M8:

{
  "errors": [
    {
      "message": "invalid signature"
    }
  ]
}

Testing with a custom modified JWT Token I get (expected this):

{
  "errors": [
    {
      "message": "jwt audience invalid. expected: postgraphql"
    }
  ]
}

My remote endpoint deployment response from going to /graphql is this:

{"errors":[{"name":"error","length":113,"severity":"ERROR","code":"42501","file":"guc.c","line":"9604","routine":"call_string_check_hook"}]}
sardbaba commented 5 years ago

@jmparsons How did you solve this?