hayes / hayes/pothos

Prisma plugin should support async query parameter

Open
#971 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
2.6k
Forks
184
Avg merge
4h 25m
Merged PRs (30d)
137

Description

Given the following code:

```ts
playlists: t.relatedConnection('uploadLists', {
cursor: 'createdAt_id',
authScopes: privateAuthScopes,
query: async (_args, context) => {
const userId = (await context.session)?.appUserId;
invariant(userId, 'No userId');

return {
where: { type: UploadListType.PLAYLIST, author: { id: userId } },
};
},
}),
```

I get the following error:

image

It would be great if `query` could be `async` for when query parameters need to use external resources.

Contributor guide

Open the contributing guide

Research direction

Start by locating the Prisma plugin implementation that handles the `query` option shown in the issue and inspect how its return value is processed. Update the behavior so an asynchronous query can resolve to the requested filter object, then verify that the example no longer produces the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.