Skip to content

Uncaught error is thrown when port for notifier server is already in use #95

@pixtron

Description

@pixtron

Uncaught error is thrown when port for notifier server is already in use

Expected Behavior

The error EADDRINUSE should be caught and handled. Idealy the error would be bubbled up to the app if it can't be handled (see #94).

There are two cases this error might occur:

1.) appauth by itself already started a server on the given port (see #89)
Eventually an already created server could be closed and a new one created (this might interrupt a previously startet auth flow).
Another solution could be to change the server so it could handle mutliple auth flows.
Alternatively bubble up the error to the app, so the app can handle it.

2.) another process is already listening on the given port
Bubble up the error to the app, so it can react accordingly.

Describe the problem

Actual Behavior

The error is not caught, and may only be caught with process.on('UncaughtException', (err) => {})

Steps to reproduce the behavior

1.) Start the example electron app (see googlesamples/appauth-js-electron-sample/pull/3 with update to appauth v1.1.1)
2.) Click "Sign in"
3.) Go back to the app without completing consent screen
4.) Click "Sign in" again

Results in

Uncaught Error: listen EADDRINUSE :::8000

Environment

  • AppAuth-JS version: 1.1.1 (similar issue already in previous versions)
  • AppAuth-JS Environment: Node/Electron

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions