maoosi/prisma-appsync

IntrospectionQuery fails on local server

cipriancaba opened this issue · 3 comments

This is causing issues when trying to use codegen against local server schema

maoosi commented

I've tested a few things on my end, but couldn't find any introspection issue with the local dev server - would you have more details to share?

Here are the details. This happens while running codegen. Attaching codegen config as well

{
   "parentTypeName":"Query",
   "fieldName":"__schema",
   "variables":{
      
   },
   "selectionSetList":[
      "__typename",
      "queryType/name",
      "mutationType/name",
      "subscriptionType/name",
      "types/FullType",
      "directives/name",
      "directives/description",
      "directives/locations",
      "directives/args/InputValue"
   ],
   "selectionSetGraphQL":"query IntrospectionQuery {\n  __schema {\n    queryType {\n      name\n    }\n    mutationType {\n      name\n    }\n    subscriptionType {\n      name\n    }\n    types {\n      ...FullType\n    }\n    directives {\n      name\n      description\n      locations\n      args {\n        ...InputValue\n      }\n    }\n  }\n}\n\nfragment FullType on __Type {\n  kind\n  name\n  description\n  fields(includeDeprecated: true) {\n    name\n    description\n    args {\n      ...InputValue\n    }\n    type {\n      ...TypeRef\n    }\n    isDeprecated\n    deprecationReason\n  }\n  inputFields {\n    ...InputValue\n  }\n  interfaces {\n    ...TypeRef\n  }\n  enumValues(includeDeprecated: true) {\n    name\n    description\n    isDeprecated\n    deprecationReason\n  }\n  possibleTypes {\n    ...TypeRef\n  }\n}\n\nfragment InputValue on __InputValue {\n  name\n  description\n  type {\n    ...TypeRef\n  }\n  defaultValue\n}\n\nfragment TypeRef on __Type {\n  kind\n  name\n  ofType {\n    kind\n    name\n    ofType {\n      kind\n      name\n      ofType {\n        kind\n        name\n        ofType {\n          kind\n          name\n          ofType {\n            kind\n            name\n            ofType {\n              kind\n              name\n              ofType {\n                kind\n                name\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n"
}{
   "timestamp":"2023-05-20T07:13:23.608Z"
}

And the logs

[dev:public] ◭ 5/20/2023, 10:13:23 AM <<ERROR>> Error parsing 'action' from input event. If you are trying to query a custom resolver, make sure it is properly declared inside 'prismaAppSync.resolve({ event, resolvers: { /* HERE */ } })'.
[dev:public] {
[dev:public]   error: "Error parsing 'action' from input event. If you are trying to query a custom resolver, make sure it is properly declared inside 'prismaAppSync.resolve({ event, resolvers: { /* HERE */ } })'.",
[dev:public]   type: 'INTERNAL_SERVER_ERROR',
[dev:public]   code: 500
[dev:public] }

codegen.ts

import { CodegenConfig } from '@graphql-codegen/cli'

const config: CodegenConfig = {
  overwrite: true,
  schema: {
    'http://localhost:4000/graphql',
  },
  documents: ['./graphql/apiClient.graphql'], // random query
  ignoreNoDocuments: false, // for better experience with the watcher
  verbose: true,
  debug: true,
  config: {
    sort: false,
    skipTypename: true,
    scalars: {
      AWSDateTime: 'any',
      AWSEmail: 'any',
      AWSJSON: 'any',
      AWSURL: 'any',
    },
  },
  emitLegacyCommonJSImports: false,
  generates: {
    './src/api/apiClient.ts': {
      // preset: 'client',
      plugins: [
        'typescript',
        'typescript-operations',
        'typescript-graphql-request',
      ],
      config: {
        preResolveTypes: true,
        onlyOperationTypes: true,
        skipTypeNameForRoot: true,
        skipTypename: true,
        avoidOptionals: false,
        autogenSWRKey: true,
        ignoreEnumValuesFromSchema: false,
        inlineFragmentTypes: 'combine',
        allowEnumStringTypes: true,
        enumsAsTypes: true,
        pureMagicComment: true,
        documentMode: 'graphQLTag',
      },
    },
  },
}

export default config

It fails on the first call when it's trying to fetch the schema

maoosi commented

Will be released as part of 1.0.0-rc.7.