You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using multi services and I call services through another service hook
the problem is if service failds ,for example there was duplicated row
it shouden't continue and should rollaback
but this not happen
this is my code :
registration.service.js
// Initializes the `users` service on path `/registeration`
const createService = require('feathers-knex');
const createModel = require('../../../models');
const hooks = require('./registration.hooks');
module.exports = function (app) {
const Model = createModel(app);
const cognitoPool = app.get('cognitoPool');
const options = {
name: 'Accounts',
Model,
paginate:false,
cognitoPool
};
// Initialize our service with any options it requires
app.use('/registration', createService(options));
// Get our initialized service so that we can register hooks and filters
const service = app.service('registration');
service.hooks(hooks(options));
};
And afterRegistration hook calls users service with ...params, i assume to share a transaction. But the problem is that all hooks are executed first and then specific method ones. And in this case a transaction is committed and removed from params with transaction.end hook, so users service will not share the transaction, and if users service fails then you end up with a created registration and no user.
I'm using Knex transactions in hooks and I followed the documentation which says
I'm using multi services and I call services through another service hook
the problem is if service failds ,for example there was duplicated row
it shouden't continue and should rollaback
but this not happen
this is my code :
registration.service.js
registration.hooks.js
beforeRegisration.js
afterRegistration.js
and this is the users.hooks.js
Expected behavior
rollback when error happened
Actual behavior
not rolling back
System configuration
Tell us about the applicable parts of your setup.
Module versions (especially the part that's not working):
NodeJS version:
v10.15.3
Operating System:
ubuntu
kind Regards
The text was updated successfully, but these errors were encountered: