Skip to content

Add helpful error message if redirectTo path is bad #13231

@sbaechler

Description

@sbaechler

What is the improvement or update you wish to see?

It looks like the redirectTo path in the signIn method has to start with a forward slash. I accidentally passed a value without a slash (e.g. dashboard instead of /dashboard) which causes a fatal error in next.js.

The error messages shown to the developer are ambiguous. Either next.js reports an error in the LoginButton UI component which calls await signIn("microsoft-entra-id", { redirectTo }); or there is a "bad configuration" error page. There is no helpful stacktrace that could lead a developer to the issue.

A server error in the runtime that is caused by a string value is really hard to debug. Please add a check and a helpful error message for the signIn method.

Is there any context that might help us understand?

I spent way too long debugging a weird login issue that was caused by a relative path as a fallback value to redirectTo.

Does the docs page already exist? Please link to it.

I haven't found it, but the error should be shown in the Error.message and the error page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions