Skip to content

Suppress stack traces from loopback.errorHandler output in production #564

Closed

Description

@bajtos

strong-remoting was recently fixed to exclude the stack trace from the error response when process.env.NODE_ENV === 'development'.

However, loopback.errorHandler used by the scaffolded server/server.js does not support this feature.

We should modify loopback.errorHandler to return middleware that does not print stack traces when running in production.

Activity

  1. chinuy commented on Mar 6, 2015

    @chinuy

    Is there any timeline you want to put this implemented?

  2. bajtos commented on Mar 10, 2015

    @bajtos
    MemberAuthor

    Not really. Would you mind contributing this feature yourself?

  3. pasindud commented on Mar 21, 2015

    @pasindud

    shouldn't this be set by a config.json ? or any other flag

  4. bajtos commented on Mar 24, 2015

    @bajtos
    MemberAuthor

    shouldn't this be set by a config.json ? or any other flag

    Now that the error-handling middleware is configured in server/middleware.json, it should be reasonably easy to modify the handler factory to accept an options argument which would specify the behaviour.

  5. digitalsadhu commented on Jul 5, 2015

    @digitalsadhu
    Contributor

    So looking around a bit, I understand that express errorhandler is for development only and provides no options for disabling stack traces. It looks to me that 1 idea might be to wrap express errorhandler to either return the errorhandler middleware if we are not in production or to provide a custom piece of errorhandler middleware (without stack traces) if we are. Does that sound like the right approach @bajtos ?

  6. added a commit that references this issue on Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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