Coder Social home page Coder Social logo

Comments (5)

aapav01 avatar aapav01 commented on May 28, 2024 2

I got the same issue

Use the Stable version v3.0.0 which was released 10 days ago it works fine

other versions are not stable...

and im using [email protected]

from gqlify.

nezaidu avatar nezaidu commented on May 28, 2024 1

helped me

from gqlify.

yeuem1vannam avatar yeuem1vannam commented on May 28, 2024

It seems related to the version of graphql library.
After remove the graphql and downgrade the @gqlify/server to v1.1.7, the application can start successfully.
However, I cannot make it works for any version higher than 1.1.7

from gqlify.

alexandrethsilva avatar alexandrethsilva commented on May 28, 2024

Unfortunately I can't yet provide any meaningful solutions as I'm still trying to get my head around how GQLify works under the hood in an attempt to find fixes for other issues, but I hope this may point someone with more knowledge of the intent and purpose of the library internals in the right direction.

There has been an update on ASTDefinitionBuilder since [email protected] and some internal fields have been removed.

IMHO using graphql-js internals (as well as any other dependencies') should be probably reconsidered as it makes such issues impossible to avoid.

i.e. this:

export class ASTDefinitionBuilder {
  _typeDefinitionsMap: TypeDefinitionsMap;
  _options: ?BuildSchemaOptions;
  _resolveType: TypeResolver;
  _cache: ObjMap<GraphQLNamedType>;

  constructor(
    typeDefinitionsMap: TypeDefinitionsMap,
    options: ?BuildSchemaOptions,
    resolveType: TypeResolver,
  ) {
    this._typeDefinitionsMap = typeDefinitionsMap;
    this._options = options;
    this._resolveType = resolveType;
    // Initialize to the GraphQL built in scalars and introspection types.
    this._cache = keyMap(
      specifiedScalarTypes.concat(introspectionTypes),
      type => type.name,
    );
  }

...

buildType(node: NamedTypeNode | TypeDefinitionNode): GraphQLNamedType {
    const typeName = node.name.value;
    if (!this._cache[typeName]) {
      if (node.kind === Kind.NAMED_TYPE) {
        const defNode = this._typeDefinitionsMap[typeName];
        this._cache[typeName] = defNode
          ? this._makeSchemaDef(defNode)
          : this._resolveType(node.name.value);
      } else {
        this._cache[typeName] = this._makeSchemaDef(node);
      }
    }
    return this._cache[typeName];
  }

became this:

export class ASTDefinitionBuilder {
  _options: ?BuildSchemaOptions;
  _resolveType: TypeResolver;

  constructor(options: ?BuildSchemaOptions, resolveType: TypeResolver) {
    this._options = options;
    this._resolveType = resolveType;
  }

...

buildType(astNode: TypeDefinitionNode): GraphQLNamedType {
    const name = astNode.name.value;
    if (stdTypeMap[name]) {
      return stdTypeMap[name];
    }

    switch (astNode.kind) {
      case Kind.OBJECT_TYPE_DEFINITION:
        return this._makeTypeDef(astNode);
      case Kind.INTERFACE_TYPE_DEFINITION:
        return this._makeInterfaceDef(astNode);
      case Kind.ENUM_TYPE_DEFINITION:
        return this._makeEnumDef(astNode);
      case Kind.UNION_TYPE_DEFINITION:
        return this._makeUnionDef(astNode);
      case Kind.SCALAR_TYPE_DEFINITION:
        return this._makeScalarDef(astNode);
      case Kind.INPUT_OBJECT_TYPE_DEFINITION:
        return this._makeInputObjectDef(astNode);
    }

    // Not reachable. All possible type definition nodes have been considered.
    /* istanbul ignore next */
    throw new Error(
      `Unexpected type definition node: "${inspect((astNode: empty))}".`,
    );
  }
...

My guess while having a first look is that this technique was being used to add the schema Types to this internal _typeDefinitionsMap of allowed definitions to be validated, but [email protected] uses a hard-coded list, coming from this file, so... no dice.

export const specifiedScalarTypes: $ReadOnlyArray<*> = [
  GraphQLString,
  GraphQLInt,
  GraphQLFloat,
  GraphQLBoolean,
  GraphQLID,
];

This is the method that checks against it:

const stdTypeMap = keyMap(
  specifiedScalarTypes.concat(introspectionTypes),
  type => type.name,
);

@wwwy3y3 Does any of what I'm saying here make sense to you?

from gqlify.

jthegedus avatar jthegedus commented on May 28, 2024

Can confirm [email protected] does not work with @gqlify/[email protected] (both lastest at the time of writing). As @nezaidu said, installing [email protected] seems to resolve the issue at this time.

from gqlify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.