Skip to content

Possible regression in 0.8.7 due to multiple instances of graphql? #267

@mattkrick

Description

@mattkrick

Hi there! When trying to upgrade, I kept getting the following error:

Error: unsupported type: String!

While debugging, I saw that isNonNullType was returning false when it shouldn't for String! in the following compiled code.

if ((0, import_graphql.isNonNullType)(type)) {
    type = type.ofType;
    const nullErrorStr = `"Cannot return null for non-nullable field ${parentType.name}.${getFieldNodesName(fieldNodes)}."`;
    body += `(${GLOBAL_NULL_ERRORS_NAME}.push(${createErrorObject(
      context,
      fieldNodes,
      previousPath,
      nullErrorStr
    )}), null) :`;
    errorDestination = GLOBAL_NULL_ERRORS_NAME;
  } 

Digging deeper, I saw it was because import_graphql was coming from the following webpackified package:

/***/ 500722:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

whereas e.g. definitions were coming from a different ESM package, which i didn't install, but I believe is used internally by this package

/***/ 763754:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";


Object.defineProperty(exports, "__esModule", ({
  value: true,
}));

Since isNonNullType uses instanceof internally, I assume the use of different graphql packages is the culprit. I only have 1 graphql installed in my project, so I was wondering if it's because of #252 or #257?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions