Skip to content

Exception thrown from _fullyScopeQueryParams #14010

@alisdair

Description

@alisdair

Since upgrading to 2.7, our app has been throwing errors in production on some transitions. We have around 600 errors recorded in the past week.

I haven't been able to reproduce these in a development environment, so all I have to go on is a stack trace. But it looks to me like there's something going askew on the path from transitionTo to the new _fullyScopeQueryParams introduced in #13273 by @raytiley.

The error we're seeing is:

Cannot use 'in' operator to search for 'type' in undefined

(The exact query param searched for varies.)

Looking at the definition of this method, the only use of the in operator is against its queryParams argument, which therefore must somehow be undefined.

Backing up the stack trace, this parameter is set in transitionTo, and the only path I can see where it could possibly be undefined is this code:

if (possibleQueryParams && possibleQueryParams.hasOwnProperty('queryParams')) {
  queryParams = args.pop().queryParams;
} else {
  queryParams = {};
}

I can't find anything in our app or dependencies that is doing strange things with queryParams in links or transitions, but my knowledge of the router guts ends here.

So while I'm stuck about the root cause, all I can suggest is that we could add a fallback. If the queryParams property of the popped arg isn't an object, default to {}, as in the other branch of the if statement.

Would that approach be acceptable? Or can anyone suggest further steps I could take to track down the root cause of the bug?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions