Skip to content

Latest commit

 

History

History
54 lines (34 loc) · 1.68 KB

README.md

File metadata and controls

54 lines (34 loc) · 1.68 KB

Reproduction of issues encountered integrating Hono and Pothos

There are 3 tests in the repo which currently fail. Each of these is outlined after the Quick Start section.

Quick Start

The repro code is contained in /src/index.ts. To install, run:

npm install

To build, run:

npm run build

To run tests:

npm run tests

To run locally in dev (http://localhost:8787/graphql):

npm run dev

TEST: should return 200 and correct content if context propagated correctly

Mutation: noContext

The pipeline context (containing request details etc) isn't propagated down to resolvers. If I include a rootResolver, it does get propagated to that.

TEST: should return 200 and correct content if authScopes handled correctly

Mutation: authScopesIssue

If I include authScopes: { public: true } on the resolver for authorization purposes Pothos gives this error, returned as a GraphQL error:

{"errors":[{"message":"Invalid value used as weak map key","locations":[{"line":1,"column":12}],"path":["authScopesIssue"]}]}

I raised an issue in the Pothos repo: hayes/pothos#1064, and it's most likely caused by not receiving the context correctly in the resolver. So if the first issue is fixed, then hopefully this should be too.

TEST: should directly return 401 if graphql errors handling can be bypassed

Mutation: errorHandling

In some instances (e.g. a device authentication mutation I'm working on), it would be good to be able to return standard http codes, but everything seems to get returned as a GraphQL response.

License

MIT