maoosi / prisma-appsync

⚡ Turns your ◭ Prisma Schema into a fully-featured GraphQL API, tailored for AWS AppSync.
https://prisma-appsync.vercel.app
BSD 2-Clause "Simplified" License
226 stars 18 forks source link

Error in sorting #110

Closed tomschut closed 1 year ago

tomschut commented 1 year ago

Hi,

I've recently started exploring your wonderful generator, and have run into an issue. We've attached a postgresql db to an existing (keystone generated) schema from which we've generated the appsync client. When running locally everything works smoothly, except for sorting. A query like: listSeasons(orderBy: {updatedAt: ASC}) throws an error: "message": "EnumType is not defined"

I haven't investigated much yet, but am wondering whether you could help me determine where the error could stem from.

Kind regards,

maoosi commented 1 year ago

Thanks @tomschut!

After adding prisma-appsync as a generator in your Prisma schema file...

generator appsync {
  provider = "prisma-appsync"
}

... running npx prisma generate should automatically generate a generated/prisma-appsync/schema.gql file containing the following:

enum OrderByArg {
    ASC
    DESC
}

input SeasonOrderByInput {
    updatedAt: OrderByArg
}

Could you please double-check that the above OrderByArg enum and SeasonOrderByInput input are indeed present in the generated schema.gql file?

If not, could you please share your schema.prisma file, along with your generated schema.gql (minus any sensitive information)?

tomschut commented 1 year ago

hi @maoosi ,

Thanks for your swift reply.

I've inspected both the schema.gql file for both objects, and both are exactly the same as in your message.

I'm not really at liberty to share the schema's at the moment. Is there anything specifically I could check?

I've also tried to up the log level on the yoga server, but I'm not getting any further than:

DEBUG Parsing request to extract GraphQL parameters
DEBUG Processing GraphQL Parameters

Is there anything I can do to get some more insight into this, I've tried to see if there's any logging inside the generated handler, but can only find the PRISMA_APPSYNC_TESTING which doesn't add anything to this particular error.

I'll also run a test in AWS to see if the problem also arises there.

Kind regards,

maoosi commented 1 year ago

What version of prisma-appsync are you currently using?

I'll also run a test in AWS to see if the problem also arises there.

Please let me know once you have, as it would help understand if the issue is related to the local dev server or something else.

tomschut commented 1 year ago

"prisma-appsync": "^1.0.0-rc.5",

The bug seems to be caused by the use of the dev server. I've successfully run a query with an order by field on appsync.

maoosi commented 1 year ago

Could you try prisma-appsync@1.0.0-preview.6.8 instead and let me know if still an issue?

tomschut commented 1 year ago

that fixes it, thank you so much!

I reckon I can keep using the preview until a new release?

maoosi commented 1 year ago

Yes, feel free to use it until the next rc release!