File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -169,7 +169,12 @@ RestWrite.prototype.execute = function () {
169
169
throw new Parse . Error ( Parse . Error . EMAIL_NOT_FOUND , 'User email is not verified.' ) ;
170
170
}
171
171
return this . response ;
172
- } ) ;
172
+ } ) . finally ( ( ) => {
173
+ if ( this . context . transaction ) {
174
+ // Ensure isolation even on uncaught errors
175
+ this . config . database . setTransactionalSession ( null ) ;
176
+ }
177
+ } ) ; ;
173
178
} ;
174
179
175
180
// Uses the Auth object to get the list of roles, adds the user id
Original file line number Diff line number Diff line change @@ -281,11 +281,15 @@ export function getRequestObject(
281
281
triggerType === Types . afterFind
282
282
) {
283
283
// Set a copy of the context on the request object.
284
- request . context = Object . assign ( {
285
- createTransactionalSession : config . database . createTransactionalSession . bind ( config . database ) ,
286
- commitTransactionalSession : config . database . commitTransactionalSession . bind ( config . database ) ,
287
- abortTransactionalSession : config . database . abortTransactionalSession . bind ( config . database ) ,
288
- } , context ) ;
284
+ request . context = Object . assign (
285
+ { } ,
286
+ context ,
287
+ {
288
+ createTransactionalSession : config . database . createTransactionalSession . bind ( config . database ) ,
289
+ commitTransactionalSession : config . database . commitTransactionalSession . bind ( config . database ) ,
290
+ abortTransactionalSession : config . database . abortTransactionalSession . bind ( config . database ) ,
291
+ }
292
+ ) ;
289
293
}
290
294
291
295
if ( ! auth ) {
You can’t perform that action at this time.
0 commit comments