Undefined error, unhanded promise error

95 views
Skip to first unread message

Andrew Coad

unread,
Jul 31, 2018, 11:42:30 AM7/31/18
to Angular and AngularJS discussion
Hi,

First of all, I do not know whether what I am seeing is an AngularJS issue or an ng-admin issue.

My setup is:
 - ng-admin 1.0.13
 - angularJS 1.6.4
 - loopback 3.20.0
 - nodeJS 8.11.3

The application that is throwing errors is really simple - it comprises an ng-admin with three entities - each entity has the expected list, show, creation, edition views. All entities throw errors, for example
 - take any entity and create a new instance. All goes as expected until I hit the submit button at which time I get the following:

[Error] undefined is not an object (evaluating 'e.data.message')                          angular.min.js:95
http://urj.orbitune.net:3000/js/ng-admin.min.js:50 – "Possibly unhandled rejection: {\"line\":50,\"column\":29569,\"sourceURL\":\"http://urj.orbitune.net:3000/js/ng-admin.min.js\"}"
(anonymous function) (ng-admin.min.js:7:21502)
l (ng-admin.min.js:8:9436)
$digest (ng-admin.min.js:8:15285)
(anonymous function) (ng-admin.min.js:8:16853)
i (ng-admin.min.js:6:29828)
(anonymous function) (ng-admin.min.js:6:31273)

The instance is created correctly and I can manipulate as expected. However, when I try to delete the instance (on clicking the final confirmation button), I get:

[Error] Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'e.data.message')                handleDefaultError - HttpErrorService.js:27
handleDefaultError (ng-admin.min.js:50:29570)
handleError (ng-admin.min.js:50:29315)
(anonymous function) (ng-admin.min.js:48:13957)
promiseReactionJob

Again, the instance is correctly deleted from the application. Another observation is that these errors mess up the sessionStorage in the browser (both Chrome and Safari) - I store small amounts of data in sessionStorage but after the errors above, sessionStorage is empty.

I'm not clear where to start to debug this issue so any pointers would be very welcome.

Regards,
ac

Sander Elias

unread,
Aug 4, 2018, 11:05:25 PM8/4/18
to Angular and AngularJS discussion
Hi Andrew,

Sound like a timing issue. I think you delete something that is still in use by the view at that moment. as a hack, to figure out what is going on, you can try putting that part of the code on a setTimeout. if that works, you still need to figure out what is going on, otherwise, this will come back and haunt you in the future.

Regards
Sander

Andrew Coad

unread,
Aug 5, 2018, 9:01:27 PM8/5/18
to ang...@googlegroups.com
Sander,

Many thanks for your response.

The situation that I describe happens both when I create a new object as well as delete it. On the creation side, there is no code that I have written – it is pure out-of-the-box ng-admin.

I recently upgraded my installation so it is possible that I have a version problem (I don’t know if this problem existed before the upgrade because I never looked to see).

My thinking is that I need to do a completely clean rebuild on a test machine and see if I can reproduce the issue.

Kind regards,
ac

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Sander Elias

unread,
Aug 8, 2018, 6:43:58 AM8/8/18
to Angular and AngularJS discussion
Hi Andrew,

Did you get this figured out?

Regards
Sander
Reply all
Reply to author
Forward
0 new messages