Tonny (sstNerd)
05/28/2022, 7:11 AMTonny (sstNerd)
05/28/2022, 9:09 PMError: Cannot use GraphQLSchema "{ __validationErrors: undefined, description: undefined, extensions: {}, astNode: { kind: "SchemaDefinition", operationTypes: [Array] }, extensionASTNodes: [], _queryType: Query, _mutationType: undefined, _subscriptionType: undefined, _directives: [@include, @skip, @deprecated, @specifiedBy], _typeMap: { Query: Query, String: String, Boolean: Boolean, __Schema: __Schema, __Type: __Type, __TypeKind: __TypeKind, __Field: __Field, __InputValue: __InputValue, __EnumValue: __EnumValue, __Directive: __Directive, __DirectiveLocation: __DirectiveLocation }, _subTypeMap: {}, _implementationsMap: {} }" from another module or realm. Ensure that there is only one instance of "graphql" in the node_modules directory. If different versions of "graphql" are the dependencies of other relied on modules, use "resolutions" to ensure only one version is installed. <https://yarnpkg.com/en/docs/selective-version-resolutions> Duplicate "graphql" modules cannot be used at the same time since different versions may have different capabilities and behavior. The data from one version used in the function from another could produce confusing and spurious results.
Anyone faced this before?Frank
sforman
05/31/2022, 7:44 AMFrank
graphql
doesn’t play well with esm
, so you need to make 2 changes:
1. In ur stacks/MyStack.ts
, change this
const api = new GraphQLApi(stack, "ApolloApi", {
server: "functions/lambda.handler",
});
to
const api = new GraphQLApi(stack, "ApolloApi", {
server: {
handler: "functions/lambda.handler",
bundle: {
format: "cjs",
},
},
});
2. In your backend/functions/lambda.ts
, remove this line
playground: IS_LOCAL,
Frank
Tonny (sstNerd)
05/31/2022, 4:24 PMFrank
Frank
esm
.sforman
05/31/2022, 4:29 PM