Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'startSession' of undefined #304

Closed
wiva-koikoi opened this issue Feb 23, 2019 · 0 comments
Closed

Cannot read property 'startSession' of undefined #304

wiva-koikoi opened this issue Feb 23, 2019 · 0 comments

Comments

@wiva-koikoi
Copy link

node_modules/feathers-mongoose/lib/transaction-manager.js (line 12):
const client = context.app.get('mongoDbClient');

src/mongoose.js:
app.set('mongooseClient', mongoose);

We set 'mongooseClient' but get 'mongoDbClient'.

If I add
app.set('mongoDbClient', mongoose);
near
app.set('mongooseClient', mongoose);

the error is gone.

Steps to reproduce

  1. As described in doc, add in src/app.hooks.js:

const TransactionManager = require('feathers-mongoose').TransactionManager;
const isTransactionEnable = process.env.TRANSACTION_ENABLE === "true" ? true : false;
const skipPath = [ 'authentication' ];

and

module.exports = {
before: {
...
create: [
when(isTransactionEnable, async hook => TransactionManager.beginTransaction(hook, skipPath)),
...

TRANSACTION_ENABLE=true node src/

curl --request POST \
--url http://0.0.0.0:3030/people \
--header 'content-type: application/json' \
--data '[
{ "name": "text" },
{ "name": "text" }
]'

Expected behavior

Transaction session starts success

Actual behavior

{
"name": "GeneralError",
"message": "Error while starting session TypeError: Cannot read property 'startSession' of undefined",
"code": 500,
"className": "general-error",
"data": {},
"errors": {}
}

System configuration

Module versions (especially the part that's not working):
"@feathersjs/feathers": "^3.3.1",
"feathers-mongoose": "^7.3.1",

NodeJS version:
v10.15.1

Operating System:
Linux 4.15.0-45-generic #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Browser Version:

React Native Version:

Module Loader:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant