Comments (9)
This is my setup with 0.2.0-rc.1
, hope it helps ...
import express from 'express'
import cors from 'cors'
import bodyParser from 'body-parser'
import async from 'asyncawait/async'
import await from 'asyncawait/await'
import { apolloExpress, graphiqlExpress } from 'apollo-server'
import { makeExecutableSchema } from 'graphql-tools'
import schema from './server/data/schema'
import resolvers from './server/data/resolvers'
import config from './config'
// create express server
const app = express()
// use cors
app.use(cors())
// use bodyparser
app.use(bodyParser.urlencoded({ extended: true }))
app.use(bodyParser.json())
...
// graphql endpoint
app.use('/graphql', apolloExpress(async (req) => {
const user = await getAuthenticatedUser(req)
return {
schema: makeExecutableSchema({
typeDefs: schema,
resolvers,
allowUndefinedInResolve: true,
}),
context: { user } // add user to the context
}
}))
// graphiql endpoint
app.use('/graphiql', graphiqlExpress({
endpointURL: '/graphql',
}))
// start express server
app.listen(config.server.port, () => console.log(
`==> GraphQL Server is now running on http://localhost:${config.server.port}`
))
from apollo-server.
@savovs @HriBB Guys, @rszewczyk is correct. We made a mistake and released an RC version of the project to NPM. We have fixed the problem and now when you npm install apollo-server
you will get version 0.1.5 which is the working version. Please make sure you use this version until we get the release candidate fully working and documented.
Sorry for any hassle this may have caused.
from apollo-server.
I ran into the same problem. It looks like there were breaking changes from v0.1.5 to the current version (0.2.0-rc.1) that aren't yet covered in the tech preview docs. If you install v0.1.5, you should have better luck.
Actually, I didn't feel satisfied with the above answer, so here's what I was able to get working with the current version:
https://gist.github.com/rszewczyk/9408f0aa70b33b20d5372f23474bee4e
from apollo-server.
I believe this is fixed now. Feel free to re-open if it's still not working for you.
from apollo-server.
@helfer @nnance I'm still getting this error with a fresh install of apollo in a Meteor integration:
W20160810-06:05:07.119(-4)? (STDERR) TypeError: apolloServer is not a function
W20160810-06:05:07.119(-4)? (STDERR) at createApolloServer (packages/apollo/main-server.js:21:34)
W20160810-06:05:07.120(-4)? (STDERR) at meteorInstall.server.server.js (server/server.js:5:1)
W20160810-06:05:07.121(-4)? (STDERR) at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)
W20160810-06:05:07.121(-4)? (STDERR) at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:82:1)
W20160810-06:05:07.121(-4)? (STDERR) at /Users/scott/Develop/Meteor/AdAbounds/.meteor/local/build/programs/server/app/app.js:89:1
W20160810-06:05:07.122(-4)? (STDERR) at /Users/scott/Develop/Meteor/AdAbounds/.meteor/local/build/programs/server/boot.js:297:10
W20160810-06:05:07.122(-4)? (STDERR) at Array.forEach (native)
W20160810-06:05:07.122(-4)? (STDERR) at Function._.each._.forEach (/Users/scott/.meteor/packages/meteor-tool/.1.4.0-1.nv68bz++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20160810-06:05:07.123(-4)? (STDERR) at /Users/scott/Develop/Meteor/AdAbounds/.meteor/local/build/programs/server/boot.js:133:5
W20160810-06:05:14.321(-4)? (STDERR) WARNING: npm peer requirements (for apollo) not installed:
W20160810-06:05:14.322(-4)? (STDERR) - [email protected] installed, apollo-server@^0.1.1 needed
It looks like the latest [email protected]
is incompatible with the apollo atmosphere package?
- Meteor 1.4.0.1
- [email protected]
- [email protected]
from apollo-server.
@scottmcpherson Look this: http://docs.apollostack.com/apollo-server/migration.html :)
from apollo-server.
Thanks @Grmiade :) I guess I'm not 100% sure how this ties in with the apollo atmosphere package and the createApolloServer
function.
I'm guessing the apollo atmosphere package still uses the old apolloServer
?
Right now, in my server.js I'm using the createApolloServer
function:
import { createApolloServer } from 'meteor/apollo';
import { schema, resolvers } from '/imports/api/schema';
createApolloServer({
graphiql: true,
pretty: true,
schema,
resolvers,
});
Do you know if createApolloServer
is no longer the recommended approach in a Meteor app?
from apollo-server.
I'm guessing the apollo atmosphere package still uses the old apolloServer?
Found the answer to the first question:
https://github.com/apollostack/meteor-integration/blob/master/main-server.js#L3
from apollo-server.
The answer to your question is on the last two lines:
W20160810-06:05:14.321(-4)? (STDERR) WARNING: npm peer requirements (for apollo) not installed:
W20160810-06:05:14.322(-4)? (STDERR) - [email protected] installed, apollo-server@^0.1.1 needed
The meteor integration currently only supports apollo server 0.1.x, but you have the backwards incompatible 0.2.x installed. You need to make sure you have the correct version of Apollo server installed.
from apollo-server.
Related Issues (20)
- Error from resolver without extensions[V3 was not adding extensions in any error type from resolvers] HOT 2
- Integration of AS4 with graphql-jit not working HOT 3
- Bun integration on subscription (Query and Mutation Works, but not Subscription) HOT 3
- TypeSafe Custom GQLError HOT 2
- support for fastify version 4 HOT 2
- Allow passing http2 server to ApolloServerPluginDrainHttpServer
- ApolloServerPluginUsageReporting reportTimer has incorrect type HOT 1
- Elasticache cluster - CROSSLOT Keys in request don't hash to the same slot HOT 4
- Unable to package/deploy with serverless using Node14 and apollo-serverless-core HOT 3
- ApolloServerPluginUsageReporting does not allow to pass http agent HOT 11
- Misconfigured `sendVariableValues` results in similar behavior as `{all: true}` HOT 3
- ApolloServerPluginUsageReporting does not allow to pass http agent HOT 2
- Apis that have their requests cached dont need to make unnecessary auth token fetches
- Document known mitigated security issue in `@koa/cors` for AS3 users HOT 1
- Update `@koa/cors` dependency for AS3 (or why we don't intend to) HOT 2
- Share and modify variables between Express and the GraphQL/Apollo server HOT 1
- Error: ApolloServer<BaseContext>' is not assignable to type 'ApolloServer<ExpressContext> HOT 3
- callback function for onSchemaLoadOrUpdate when upgrading from AS v3 to AS v4 HOT 3
- Allow plugins to throw meaningful GraphQL errors
- Getting started tutorial has typescript issues...
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo-server.