Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Make ErrorConstructor more robust for DataCloneError (v1.7.4) #16707

Open
binarykitchen opened this issue Oct 1, 2018 · 5 comments
Open

Make ErrorConstructor more robust for DataCloneError (v1.7.4) #16707

binarykitchen opened this issue Oct 1, 2018 · 5 comments

Comments

@binarykitchen
Copy link

Seeing lots of those errors in my app:

Uncaught DataCloneError: Failed to execute 'postMessage' on 'Window': function (){var paramPrefix,i,code=arguments[0],template=arguments[1],message=\"[\"+(module?module+\":\":\"\")+code+\"...<omitted>...)} could not be cloned.

caused from user agent facebookexternalhit. After some examinations it turns out to happen inside the ErrorConstructor of v1.7.4 itself.

I think the constructor itself should be more stable when an error inside occurs, probably with a try-catch block. My guess is the toDebugString() fn which calls the serializeObject() fn where this happens, where a cloning attempt is made and fails.

There I would make the code more robust.

@gkalpak
Copy link
Member

gkalpak commented Oct 1, 2018

The ErrorConstructor is usually just the built-in Error constructor (so I doubt that's where the error happens). We need more info in order to understand the root cause of the problem and the most appropriate fix (although you are probably right that we should be more fault-tolerant inside toDebugString() anyway).

Can you reliably reproduce the error? If so, it would be helpful to get more context about the actual error that is thrown.

@binarykitchen
Copy link
Author

Well, since this only happens with the user agent facebookexternalhit, very hard to reproduce on my app with minified code.

Already have invested almost one hour deciphering that and am 99% sure it's a problem in toDebugString and/or serializeObject ...

Yes please, can you make it more fault tolerant pretty please? With more unit test coverages and try-catch blocks skipping the problematic values.

@gkalpak
Copy link
Member

gkalpak commented Oct 2, 2018

With AngularJS having entered its LTS period, I am a little reluctant to make a change in order to solve a problem we don't fully understand. It would be nice to get more info on this.

@petebacondarwin
Copy link
Contributor

So it appears that something in your code is trying to pass the return value from a call to minerr (e.g. this function https://github.com/angular/angular.js/blob/master/src/minErr.js#L101) across a thread boundary (hence the postmessage). It is not related to the ErrorConstructor.

This is not a scenario that AngularJS supports. If you could find exactly where this was happening we could look into it, but otherwise there is not much more we can do.

@binarykitchen
Copy link
Author

I hear you. Very difficult to debug or reproduce this scenario here. More weird is that this only happens with the facebookexternalhit user agent.

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

No branches or pull requests

3 participants