Skip to content

App logger is not passed to receivers #2521

@zimeg

Description

@zimeg

The app logger used in receivers is not the same as the shared app logger if no logger is specified in the app constructor:

bolt-js/src/App.ts

Lines 323 to 331 in ee8df73

/* ------------------------ Set logger ----------------------------- */
if (typeof logger === 'undefined') {
// Initialize with the default logger
const consoleLogger = new ConsoleLogger();
consoleLogger.setName('bolt-app');
this.logger = consoleLogger;
} else {
this.logger = logger;
}

bolt-js/src/App.ts

Lines 405 to 421 in ee8df73

this.receiver = this.initReceiver(
receiver,
signingSecret,
endpoints,
port,
customRoutes,
processBeforeResponse,
signatureVerification,
clientId,
clientSecret,
stateSecret,
redirectUri,
installationStore,
scopes,
appToken,
logger,
);

The constructed logger might be used here instead? 🤔

@slack/bolt version

@slack/bolt@4.3.0

Your App and Receiver Configuration

const app = new App({
  token: process.env.SLACK_BOT_TOKEN,
  socketMode: true,
  appToken: process.env.SLACK_APP_TOKEN,
  logLevel: LogLevel.DEBUG,
  customRoutes: [
    {
      path: '/health-check',
      method: ['GET'],
      handler: (req, res) => {
        res.writeHead(200);
        res.end(`Things are going just fine at ${req.headers.host}!`);
      },
    },
  ],
});

Node.js runtime version

v22.14.0

Steps to reproduce:

  1. Start an app with custom routes
  2. Visit an unexpected endpoint: http://localhost:3000/ohno
  3. Review the logs

Expected result:

[INFO]  bolt-app An unhandled HTTP request (GET) made to /ohno was ignored

Actual result:

[INFO]   An unhandled HTTP request (GET) made to /ohno was ignored

Requirements

For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-triage-skipPrevent this issue from being closed due to lack of activitybugM-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions