hasura / ra-data-hasura

react-admin data provider for Hasura GraphQL Engine
MIT License
338 stars 70 forks source link

getIntrospectionQuery was not found in 0.4.0 #87

Open mhmnemati opened 2 years ago

mhmnemati commented 2 years ago

Hi,

I'm trying to switch from ra-data-hasura@0.2.0 to ra-data-hasura@0.4.0, but when I run npm start I will get this error:

ERROR in ./node_modules/ra-data-hasura/node_modules/ra-data-graphql/esm/introspection.js 249:162-183
export 'getIntrospectionQuery' (imported as 'getIntrospectionQuery') was not found in 'graphql' (possible exports: ArgumentsOfCorrectTypeRule, BREAK, BreakingChangeType, DEFAULT_DEPRECATION_REASON, DangerousChangeType, DefaultValuesOfCorrectTypeRule, DirectiveLocation, FieldsOnCorrectTypeRule, FragmentsOnCompositeTypesRule, GraphQLBoolean, GraphQLDeprecatedDirective, GraphQLDirective, GraphQLEnumType, GraphQLError, GraphQLFloat, GraphQLID, GraphQLIncludeDirective, GraphQLInputObjectType, GraphQLInt, GraphQLInterfaceType, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLScalarType, GraphQLSchema, GraphQLSkipDirective, GraphQLString, GraphQLUnionType, Kind, KnownArgumentNamesRule, KnownDirectivesRule, KnownFragmentNamesRule, KnownTypeNamesRule, LoneAnonymousOperationRule, NoFragmentCyclesRule, NoUndefinedVariablesRule, NoUnusedFragmentsRule, NoUnusedVariablesRule, OverlappingFieldsCanBeMergedRule, PossibleFragmentSpreadsRule, ProvidedNonNullArgumentsRule, ScalarLeafsRule, SchemaMetaFieldDef, SingleFieldSubscriptionsRule, Source, TokenKind, TypeInfo, TypeKind, TypeMetaFieldDef, TypeNameMetaFieldDef, UniqueArgumentNamesRule, UniqueDirectivesPerLocationRule, UniqueFragmentNamesRule, UniqueInputFieldNamesRule, UniqueOperationNamesRule, UniqueVariableNamesRule, ValidationContext, VariablesAreInputTypesRule, VariablesInAllowedPositionRule, __Directive, __DirectiveLocation, __EnumValue, __Field, __InputValue, __Schema, __Type, __TypeKind, __esModule, assertAbstractType, assertCompositeType, assertInputType, assertLeafType, assertNamedType, assertOutputType, assertType, assertValidName, astFromValue, 
buildASTSchema, buildClientSchema, buildSchema, concatAST, createSourceEventStream, defaultFieldResolver, doTypesOverlap, execute, extendSchema, findBreakingChanges, findDangerousChanges, findDeprecatedUsages, formatError, getDirectiveValues, getLocation, getNamedType, getNullableType, getOperationAST, getVisitFn, graphql, introspectionQuery, isAbstractType, isCompositeType, isEqualType, isInputType, isLeafType, isNamedType, isOutputType, isType, isTypeSubTypeOf, isValidJSValue, isValidLiteralValue, parse, parseType, parseValue, print, printIntrospectionSchema, printSchema, printType, responsePathAsArray, separateOperations, specifiedDirectives, specifiedRules, subscribe, typeFromAST, validate, valueFromAST, visit, visitInParallel, visitWithTypeInfo)
 @ ./node_modules/ra-data-hasura/node_modules/ra-data-graphql/esm/index.js 175:0-51 176:0-32 176:0-32 192:24-40     
 @ ./node_modules/ra-data-hasura/dist/customDataProvider/index.js 16:42-68
 @ ./node_modules/ra-data-hasura/dist/index.js 75:27-58
 @ ./src/providers/dataProvider.ts 3:0-66 28:31-50 38:19-30
 @ ./src/index.tsx 10:0-54 36:31-47
arjunyel commented 2 years ago

@ckoliber Hello friend, could you try upgrading to 0.4.1? If that doesn't work could you try deleting your node_modules and package-lock.json and trying to reinstall? Else could you please make a reproduction repo? Thank you!

mhmnemati commented 2 years ago

Hello @arjunyel, I was upgraded to 0.4.1, but the problem remains Also I've tried to remove package-lock.json and node_modules/ and re run npm i, but the problem wasn't solved

This is my current package-lock.json file.

mhmnemati commented 2 years ago

I think the problem is related to graphql-ast-types-browser library, It depends on graphql@^0.11.7, but the ra-data-graphql has peerDependency graphql@^15.6.0 The older version of graphql will be installed

arjunyel commented 2 years ago

@ckoliber ill work on fixing this in the library, in the meantime in your own package.json I think adding "graphql": "^15.6.0" should fix it?

mhmnemati commented 2 years ago

@arjunyel Currently I have it, The graphql@15.6.0 will be installed in root node_modules/ but ra-data-graphql which is installed in node_modules/ra-data-hasura/node_modules/ra-data-graphql/ will use the graphql@0.11.7 in node_modules/ra-data-hasura/node_modules/graphql/

arjunyel commented 2 years ago

Understood I'll get that fixed up, interesting I didn't run into this with my own example project. What version of NPM are you using, could you try the latest?

arjunyel commented 2 years ago

@ckoliber npm install -g npm should get you to 8.8.0, I am wondering if this is caused by an old version of NPM..

mhmnemati commented 2 years ago

@arjunyel Sorry for late, currently I'm using npm@8.9.0

grachevko commented 2 years ago

Same issue, can't update to ^4

index.js:1 TypeError: Object(...) is not a function
    at fetchSchema (introspection.js:187:1)
    at introspection.js:167:1
    at step (introspection.js:117:1)
    at Object.next (introspection.js:68:1)
    at introspection.js:48:1
    at new Promise (<anonymous>)
    at push../node_modules/ra-data-hasura/node_modules/ra-data-graphql/esm/introspection.js.__awaiter (introspection.js:27:1)
    at runSchemaIntrospection (introspection.js:158:1)
    at introspection.js:152:1
    at step (introspection.js:117:1)
    at Object.next (introspection.js:68:1)
    at introspection.js:48:1
    at new Promise (<anonymous>)
    at push../node_modules/ra-data-hasura/node_modules/ra-data-graphql/esm/introspection.js.__awaiter (introspection.js:27:1)
    at introspectSchema (introspection.js:147:1)
    at index.js:126:1
    at step (index.js:43:1)
    at Object.next (index.js:24:1)
    at index.js:18:1
    at new Promise (<anonymous>)
    at push../node_modules/ra-data-hasura/node_modules/ra-data-graphql/esm/index.js.__awaiter (index.js:14:1)
    at Proxy.<anonymous> (index.js:120:1)
    at performPessimisticQuery (performPessimisticQuery.js:36:1)
    at doQuery (doQuery.js:59:1)
    at Proxy.<anonymous> (useDataProvider.js:188:1)
    at useQueryWithStore.js:196:1
    at new Promise (<anonymous>)
    at useQueryWithStore.js:195:1
    at invokePassiveEffectCreate (react-dom.development.js:23487:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1)
    at invokeGuardedCallback (react-dom.development.js:4056:1)
    at flushPassiveEffectsImpl (react-dom.development.js:23574:1)
    at unstable_runWithPriority (scheduler.development.js:468:1)
    at runWithPriority$1 (react-dom.development.js:11276:1)
    at flushPassiveEffects (react-dom.development.js:23447:1)
    at react-dom.development.js:23324:1
    at workLoop (scheduler.development.js:417:1)
    at flushWork (scheduler.development.js:390:1)
    at MessagePort.performWorkUntilDeadline (scheduler.development.js:157:1)

docker image: node:16.15.0-alpine3.15 code: https://github.com/astra50/astra50/tree/master/crm

arjunyel commented 2 years ago

Hi friends trying to fix this upstream https://github.com/marmelab/react-admin/issues/7654

In the meantime does npm install --force work for now?

arjunyel commented 2 years ago

Hi friends, are you still having the issue with 0.4.2 or 0.5.0? Make sure to delete package-lock.json and node_modules before trying