Skip to content

Cannot use custom HTTP routes with parameters or query strings #1325

@albarivas

Description

@albarivas

Description

When I try to setup a custom HTTP route (the built-in ones) this way:

const { App } = require('@slack/bolt');

// Initialize Bolt app, using the default HTTPReceiver
const app = new App({
  token: process.env.SLACK_BOT_TOKEN,
  signingSecret: process.env.SLACK_SIGNING_SECRET,
  customRoutes: [
    {
      path: '/oauthstart/:slackUserId',
      method: ['GET'],
      handler: (req, res) => {
        res.writeHead(200);
        res.end('Do something!');
      },
    },
  ],
});

(async () => {
  await app.start();
  console.log('⚡️ Bolt app started');
})();

And I try to reach the HTTP route - for instance with http://my-bolt-app.com/oauthstart/U01T7MJ9RPY, I get the following error:

[INFO]   Unhandled HTTP request (GET) made to /oauthstart/U01T7MJ9RPY

I tried to implement the same using query strings, but I get the same error. Am I doing something wrong or is it a bug? Thanks!

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • example code related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

package version:

node version:

OS version(s):

Steps to reproduce:

Expected result:

What you expected to happen

Actual result:

What actually happened

Attachments:

Logs, screenshots, screencast, sample project, funny gif, etc.

Metadata

Metadata

Assignees

Labels

enhancementM-T: A feature request for new functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions