I tried to build an apollo server express app as a middleware but it gives the following error
C:\Files\Projects\dist\apollo\app.js:7
const server = new ApolloServer({
^
TypeError: ApolloServer is not a constructor
at Object.<anonymous> (C:\Files\Projects\dist\apollo\app.js:7:16)
ader.js:678:30) at Module._compile (internal/modules/cjs/lomodules/cjs/loader.js:689ader.js:678:30) at Object.Module._extensions..js (internal/.js:589:32)
modules/cjs/loader.js: er.js:528:12)689:10) cjs/loader.js:520:3)
const express = require('express');
const { ApolloServer } = require('apollo-server-express')
const schema = require('./Schema');
const app = express();
const server = new ApolloServer({
schema
});
server.applyMiddleware({ app });
const PORT = process.env.PORT || 4000;
app.listen(PORT, () => {
console.log(`馃殌 Server ready at http://localhost:4000${server.graphqlPath}`)
})
The contents of your package.json?
Make sure you installed rc version of apollo-server-express:
npm install --save apollo-server-express@rc
Thank you @danilobuerger and @chentsulin! Only the rc tagged packages export the ApolloServer constructor now.
@SunilDy https://www.apollographql.com/slack is a great way to get these types of questions answered quickly
I ran into the same issue. Should the docs here be updated?
https://www.apollographql.com/docs/react/recipes/meteor
@jaredtmartin Were you able to fix the blocker you raised, kindly provide how you solved it.
facing the same issue, but appearently:
npm install --save apollo-server-express@rc
doesn't fix the problem for me (with meteor:apollo)
Is this error going to be fixed any time soon? Even if I install manually apollo-server-express@rc and save it to package.json, the error is back once I rebuild the docker image.
I'm seeing this as well following this: https://www.apollographql.com/docs/react/recipes/meteor.html
Hi, I am still getting the same error. Can anybody help me?
Hi, I am getting the same error.
I caught into the same issue. It resolved after deleting package.json, package-lock.json, node_modules and then installing again. Please confirm you have the latest version
Most helpful comment
Make sure you installed
rcversion ofapollo-server-express: