Jarod G
07/06/2021, 9:03 PMimport { NonEmptyArray } from "type-graphql";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (C:\Workspace\Stagewood-Test\server\handler.js:4:19)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
I think it has something to do with how I'm generating the resolvers to TypeScript and using it in the JS handler.
This is what my handler.js looks like:
const graphqlLambda = require('apollo-server-lambda');
const makeExecutableSchema = require('graphql-tools');
const importSchema = require('graphql-import');
const resolvers = require('./prisma/generated/type-graphql/index.ts');
const typeDefs = importSchema('./schema/schema.graphql')
const myGraphQLSchema = makeExecutableSchema({
typeDefs: typeDefs,
resolvers,
});
exports.graphqlHandler = function graphqlHandler(event, context, callback){
function callbackWithHeaders(error, output) {
output.headers['Access-Control-Allow-Origin'] = '*';
callback(error, output);
}
const handler = graphqlLambda({schema: myGraphQLSchema });
return handler(event, context, callbackWithHeaders)
}
Does anyone know how I can get this working on AWS or point me in the right direction?Lars Ivar Igesund
07/06/2021, 9:14 PMJarod G
07/07/2021, 12:27 AMRyan
07/07/2021, 5:11 AM