#TypeError Cannot read properties of undefined (reading 'findOne')
30 messages · Page 1 of 1 (latest)
Showing your code would probably be helpful, 😉
export class WebsocketAdapter extends IoAdapter {
private readonly restService: RestService;
@InjectModel(User.name) private readonly userModel: Model<UserDocument>;
logger: Logger = new Logger('Gateway');
constructor(app: INestApplication) {
super(app);
this.restService = app.get(RestService);
}
.....
Where's the call you're trying to make? What's the stack trace?
in createIOServer function
And where is that? What does it look like?
const userDB = await this.userModel.findOne({
userId: userFromJson.passport.user,
});
...
If you want to keep showing small snippets of incomplete choice, great. I have no way to help you further
please ping me on response thankyou
It is my adapter file
I'll take a look when I can. Haven't been at my computer all day and mobile doesn't allow me to view the file
Ok
You need to more information?
What I need is for you to realize that I haven't had time to get back to my computer with the holidays going on and needing to spend time with family.
Those of us who provide support here do it for free and on our own time. What may constitute as high priority for you might not for any of us trying to provide support due to what's going on in our lives.
I'll try to get to it by the end of the day, but it might be tomorrow before I get a chance.
ok,sorry
If you want view it is link: https://sourceb.in/SvolOilo7N
Can you also provide the stack trace of the error so I can know what exactly I'm looking at? I think I see where, but want to be certain
Yes please wait i open project
i use webpack for compile my app
And i have try to print this.userModel and result undefined
How do you use this adapter class? Do you end up calling new to create it?
yes
Then you need to set all properties for the class. Nest will not do any DI for you
I had an old problem on this one and they recommended this:
#1055482504976543804 message
So the parameters are not in the constructor