- Notifications
You must be signed in to change notification settings - Fork 65
Open
Description
I have the following ApolloServer (v4)
import { MongoDataSource } from 'apollo-datasource-mongodb' export default class LoaderAsset extends MongoDataSource { async getAsset(assetId) { return this.findOneById(assetId) // ERROR IS HERE } } async function startApolloServer(app) { const httpServer = http.createServer(app); const server = new ApolloServer({ typeDefs, resolvers, plugins: [ApolloServerPluginDrainHttpServer({ httpServer })] }); await server.start(); app.use( '/graphql', cors(), bodyParser.json(), expressMiddleware(server, { context: async ({ req }) => { return { dataSources: { loaderAsset: new LoaderAsset(modelAsset), } } }, }), ); const port = config.get('Port') || 8081; await new Promise(resolve => httpServer.listen({ port }, resolve)); } when I run graphql and send one assetId, everything is working till I get following error:
this.findOneById is not a function
By the way (this.) has collection and model objects but not any methods.
is it because apollo-datasource-mongodb is not compatible with the new version of apollo server v4?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels