Skip to content
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

Getting "null is not an object" sometimes #18

Open
NOtherDev opened this issue Oct 21, 2020 · 9 comments
Open

Getting "null is not an object" sometimes #18

NOtherDev opened this issue Oct 21, 2020 · 9 comments

Comments

@NOtherDev
Copy link

NOtherDev commented Oct 21, 2020

Unable to reproduce myself, but Bugsnag reports this error several times a day on production, in node_modules/debounce-promise/dist/index.js:54:141:

Promise.resolve(options.accumulate ? fn.call(this, pendingArgs) : fn.apply(this, pendingArgs[pendingArgs.length - 1])).then(thisDeferred.resolve, thisDeferred.reject);

I believe it's some kind of race condition when the deferred object was already cleared.

We use ADP in React component like this:

    fetch = async () => {
        this.setState({fetching: true}, () => {
                somethingAsync()
                    .then((data) => {
                        // setState(data)
                        this.debouncer = undefined
                    })
        })
    }

    debounce = () => {
        if (!this.debouncer) {
            this.debouncer = AwesomeDebouncePromise(this.fetch, 500)
        }
        this.debouncer()
    }

    someActionCalledFromMultiplePlaces = () => {    
        this.debounce()
    }
@slorber
Copy link
Owner

slorber commented Oct 23, 2020

Hi,

This will be hard for me to fix if it's not possible to reproduce unfortunately. Maybe it is affecting only a subset of your users and you have more context about the user environment (I mean, maybe it's only a specific version of a specific browser)

Sharing the full stacktrace, not just the error message, might be helpful as well.

@NOtherDev
Copy link
Author

Yeah, I might imagine, sorry for that, I'd happily submit more if I only have it 🙂
It affects both Safari Mobile users as well as Chrome Desktop, so no clear env distinction here.
No stack trace provided by Bugsnag 😞

@slorber
Copy link
Owner

slorber commented Oct 23, 2020

Maybe someone else will come up with more infos someday 😅

Could as well be a bug in https://github.com/bjoerge/debounce-promise, the underlying lib

Also sometimes bugs like that are triggered for weird reasons like browser plugins that affect the dom in a weird way.

@maps82
Copy link

maps82 commented Nov 3, 2020

I have the same problem in a react native app: TypeError: Cannot read property 'resolve' of null stack: node_modules/debounce-promise/dist/index.js:54

It is reported on production every now and then but I was not able to reproduce it. Just to let you know.

@slorber
Copy link
Owner

slorber commented Nov 3, 2020

thanks

what's your RN version and runtime? JSC (default), V8, Hermes?
iOS/Android?

have you reported it to the original repo? as the error is thrown here?

@maps82
Copy link

maps82 commented Nov 3, 2020

No, sorry I implemented the functionality with lodash's debounce function now.

@maps82
Copy link

maps82 commented Nov 3, 2020

React native is 0.63.3 with hermes js. Until now I just had the report on android devices, but our iOS release may have the same issue (iOS version is released since a few days only)

@slorber
Copy link
Owner

slorber commented Nov 4, 2020

Thanks. Let me know if you have the problem on iOS as well, but it's likely to also be on iOS if @NOtherDev see it on Safari and Chrome.

@slorber
Copy link
Owner

slorber commented Nov 4, 2020

@bjoerge any idea? Has someone else reported the problem?

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

No branches or pull requests

3 participants