-
Notifications
You must be signed in to change notification settings - Fork 362
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
Model errors when using relations with the MongoDB connector cause crashes #111
Comments
We'll have to use domain or Zone.js to deal with uncaught errors. |
How is this not critical? By using this bug you can crash the server simply by doing a REST insert (and it keeps crashing whenever the instance is accessed until you delete the row manually from the database). |
+1 This is a critical error. I don't even get to catch the error because the server crashes before my code execution just by using a /POST with wrong data. |
+1 |
Any news on the status of this bug? Seems pretty bad |
When using not only the mongoDB, even memory DB, PUT operation with simple string on array object make server CRASH! I may change the array type in the model to |
I found a workaround to avoid server crash. In, for example, doc-model.js: docModel.observe('before save', function(ctx, next) {
if (ctx.data && ctx.data.versions && !Array.isArray(ctx.data.versions)) {
var err = new Error();
err.status = 422;
err.message = 'versions should be array type';
return next(err);
}
next();
}); This code make server not crash, but returns error. It would not be the part of loopback-datasource-juggler. |
why is this still open and not resolved? |
Would one of you guys like to submit a PR to fix or provide a sample project for us to clone/reproduce on our end? |
this still isn't fixed Unhandled error for request POST /api/v3/Policies/updatewhere?access_token=XXX "retrieveEmailsToBeNotified": [ |
@lukegorman thank you for bringing this problem to our attention. Can you please create a small application reproducing the issue? See https://loopback.io/doc/en/contrib/Reporting-issues.html#loopback-3x-bugs |
I have relations setup with a model which includes a property similar to this:
If the
versions
property is actually an object, rather than an array (due to an error in saving), loopback crashes when it attempts to resolve relations involving this model.This is the error I get:
The error itself isn't terrible, but I'd certainly rather it be returned through the HTTP request, rather than crashing the entire app.
I've tried wrapping parts of that stack in a
try
block, but it looks like the mongodb connector does some fancy magic withnextTick
to bypass the actual stack.The text was updated successfully, but these errors were encountered: