This repository was archived by the owner on Feb 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
This repository was archived by the owner on Feb 15, 2023. It is now read-only.
TypeError: instance.createActivity is not a function #57
Copy link
Copy link
Open
Description
Hey,
I'm getting the following error. I have no clue why.
Any input would be greatly appreciated.
(node:283) [MONGODB DRIVER] Warning: Top-level use of w, wtimeout, j, and fsync is deprecated. Use writeConcern instead.
events.js:377
throw er; // Unhandled 'error' event
^
TypeError: instance.createActivity is not a function
at FeedManager.activityCreated (/app/node_modules/getstream-node/src/FeedManager.js:78:28)
at /app/node_modules/getstream-node/src/backends/mongoose.js:106:24
at /app/node_modules/mongoose/lib/model.js:5074:18
at processTicksAndRejections (internal/process/task_queues.js:77:11)
Emitted 'error' event on Function instance at:
at /app/node_modules/mongoose/lib/model.js:5076:15
at processTicksAndRejections (internal/process/task_queues.js:77:11)
Follow are my model and app.js files
/* model.js */
import mongoose, { Schema } from 'mongoose'
import stream from 'getstream-node'
var FeedManager = stream.FeedManager;
const favouriteSchema = new Schema({
user: {
type: Schema.ObjectId,
ref: 'User',
required: true
},
product: {
type: Schema.ObjectId,
ref: 'Product',
required: true
}
}, {
timestamps: true,
toJSON: {
virtuals: true,
transform: (obj, ret) => { delete ret._id }
}
})
favouriteSchema.plugin(stream.mongoose.activity)
const model = mongoose.model('Favourite', favouriteSchema)
export const schema = model.schema
export default model
/* app.js */
import http from 'http'
import { env, mongo, port, ip, apiRoot } from './config'
import mongoose from './services/mongoose'
import express from './services/express'
import api from './api'
import stream from 'getstream-node'
const app = express(apiRoot, api)
const server = http.createServer(app)
if (mongo.uri) {
mongoose.connect(mongo.uri)
}
mongoose.Promise = Promise
setImmediate(() => {
server.listen(port, ip, () => {
console.log('Express server listening on http://%s:%d, in %s mode', ip, port, env)
})
});
stream.mongoose.setupMongoose(mongoose);
export default app
Metadata
Metadata
Assignees
Labels
No labels