Skip to content

[BUG]: path must be a string, array of strings, or regular expression #5881

Closed
@jamessan85

Description

@jamessan85

Tracer Version(s)

5.55.0

Node.js Version(s)

18.20.8

Bug Report

I've come across a weird edge case to do with express, express-validator and dd-trace where when I submit a form action POST request I get the error thrown from path-to-regexp - path must be a string, array of strings, or regular expression. This is working fine in dd-trace 5.45.0

Reproduction Code

Create a route in express.js

validator.js

import { check } from 'express-validator';

const usersValidator = [check('name').isAlpha().withMessage('isAlpha')];

export default usersValidator; 

router.js

import app from 'express';
import usersValidator from './validator';

const router = app.Router();

router.post('/users', [usersValidator], (req, res) => res.send('OK'));

export default router;

If you remove the array in the middleware like so router.post('/users', usersValidator, (req, res) => res.send('OK')); it works fine.

Error Logs

No response

Tracer Config

No response

Operating System

No response

Bundling

No Bundling

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions