{"id":711,"hash":"f79e9445f4627ea094b1f2320f26f3b7196c46f9fb3ba63ff98fbe7ea0861b7a","pattern":"throw new TypeError(`Missing parameter name at ${i}: ${DEBUG_URL}`);","full_message":"Gadget Controller Ts Code :\n\nimport { Request, Response, NextFunction } from 'express';\nimport { Status } from '@prisma/client'\nimport prisma from '../utils/prisma.client';\nimport { AppError } from '../utils/error.handler';\n\n// Generate random codename for gadgets\nconst generateCodename = (): string => {\n  const adjectives = ['Mighty', 'Silent', 'Phantom', 'Shadow', 'Stealth', 'Covert', 'Invisible', 'Deadly', 'Rapid', 'Quantum'];\n  const nouns = ['Eagle', 'Panther', 'Cobra', 'Viper', 'Falcon', 'Wolf', 'Hawk', 'Tiger', 'Raven', 'Phoenix'];\n  \n  const randomAdjective = adjectives[Math.floor(Math.random() * adjectives.length)];\n  const randomNoun = nouns[Math.floor(Math.random() * nouns.length)];\n  \n  return `The ${randomAdjective} ${randomNoun}`;\n};\n\n// Generate random mission success probability\nconst generateMissionProbability = (): number => {\n  return Math.floor(Math.random() * 100);\n};\n\n// Get all gadgets with optional status filter\nexport const getAllGadgets = async (req: Request, res: Response, next: NextFunction) => {\n  try {\n    const { status } = req.query;\n    \n    const whereClause = status ? { status: status as Status } : {};\n    \n    const gadgets = await prisma.gadget.findMany({\n      where: whereClause\n    });\n    \n    const gadgetsWithProbability = gadgets.map(gadget => ({\n      ...gadget,\n      missionSuccessProbability: generateMissionProbability()\n    }));\n    \n    res.status(200).json({\n      status: 'success',\n      results: gadgetsWithProbability.length,\n      data: {\n        gadgets: gadgetsWithProbability\n      }\n    });\n  } catch (error) {\n    next(error);\n  }\n};\n\n// Create a new gadget\nexport const createGadget = async (req: Request, res: Response, next: NextFunction) => {\n  try {\n    const { status } = req.body;\n    \n    const gadget = await prisma.gadget.create({\n      data: {\n        name: generateCodename(),\n        status: status || 'Available'\n      }\n    });\n    \n    res.status(201).json({\n      status: 'success',\n      data: {\n        gadget\n      }\n    });\n  } catch (error) {\n    next(error);\n  }\n};\n\n// Update a gadget\nexport const updateGadget = async (req: Request, res: Response, next: NextFunction) => {\n  try {\n    const { id } = req.params;\n    const { name, status } = req.body;\n    \n    const gadget = await prisma.gadget.findUnique({\n      where: { id }\n    });\n    \n    if (!gadget) {\n      return next(new AppError('No gadget found with that ID', 404));\n    }\n    \n    const updatedGadget = await prisma.gadget.update({\n      where: { id },\n      data: {\n        name,\n        status\n      }\n    });\n    \n    res.status(200).json({\n      status: 'success',\n      data: {\n        gadget: updatedGadget\n      }\n    });\n  } catch (error) {\n    next(error);\n  }\n};\n\n// Decommission a gadget (soft delete)\nexport const decommissionGadget = async (req: Request, res: Response, next: NextFunction) => {\n  try {\n    const { id } = req.params;\n    \n    const gadget = await prisma.gadget.findUnique({\n      where: { id }\n    });\n    \n    if (!gadget) {\n      return next(new AppError('No gadget found with that ID', 404));\n    }\n    \n    const decommissionedGadget = await prisma.gadget.update({\n      where: { id },\n      data: {\n        status: 'Decommissioned',\n        decomissionedAt: new Date()\n      }\n    });\n    \n    res.status(200).json({\n      status: 'success',\n      data: {\n        gadget: decommissionedGadget\n      }\n    });\n  } catch (error) {\n    next(error);\n  }\n};\n\n// Trigger self-destruct sequence for a gadget\nexport const selfDestructGadget = async (req: Request, res: Response, next: NextFunction) => {\n  try {\n    const { id } = req.params;\n    \n    const gadget = await prisma.gadget.findUnique({\n      where: { id }\n    });\n    \n    if (!gadget) {\n      return next(new AppError('No gadget found with that ID', 404));\n    }\n    \n    // Generate confirmation code\n    const confirmationCode = Math.floor(100000 + Math.random() * 900000);\n    \n    const updatedGadget = await prisma.gadget.update({\n      where: { id },\n      data: {\n        status: 'Destroyed',\n        selfDestruct: new Date()\n      }\n    });\n    \n    res.status(200).json({\n      status: 'success',\n      confirmationCode,\n      message: 'Self-destruct sequence initiated',\n      data: {\n        gadget: updatedGadget\n      }\n    });\n  } catch (error) {\n    next(error);\n  }\n};\n\nThe Gadgets Routes : \nrouter.get('/', getAllGadgets);\nrouter.post('/', createGadget);\nrouter.patch('/:id', updateGadget);\nrouter.delete('/:id', decommissionGadget);\nrouter.post('/:id/self-destruct', selfDestructGadget);\n\nEven though i have no error in the routing , still i am getting the error :\n\nthrow new TypeError(Missing parameter name at ${i}: ${DEBUG_URL});\n^\nTypeError: Missing parameter name at 1: https://git.new/pathToRegexpError\n\nI possibly tried everything , GPT , V0 , StackOverFlow but the solutions didn't work.\n\nHere is the package.json :\n\n{\n  \"name\": \"pg_imp\",\n  \"version\": \"1.0.0\",\n  \"main\": \"dist/index.js\",\n  \"scripts\": {\n    \"start\": \"node dist/index.js\",\n    \"dev\": \"ts-node-dev --respawn --transpile-only src/index.ts\",\n    \"build\": \"tsc\",\n    \"prisma:generate\": \"prisma generate\",\n    \"prisma:migrate\": \"prisma migrate dev --name init\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"description\": \"\",\n  \"devDependencies\": {\n    \"@types/bcrypt\": \"^5.0.2\",\n    \"@types/cors\": \"^2.8.17\",\n    \"@types/express\": \"^5.0.1\",\n    \"@types/jsonwebtoken\": \"^9.0.9\",\n    \"@types/uuid\": \"^10.0.0\",\n    \"prisma\": \"^6.5.0\",\n    \"ts-node-dev\": \"^2.0.0\",\n    \"typescript\": \"^5.8.2\"\n  },\n  \"dependencies\": {\n    \"@prisma/client\": \"^6.5.0\",\n    \"bcrypt\": \"^5.1.1\",\n    \"cors\": \"^2.8.5\",\n    \"dotenv\": \"^16.4.7\",\n    \"express\": \"^5.1.0\",\n    \"express-validator\": \"^7.2.1\",\n    \"helmet\": \"^8.1.0\",\n    \"jsonwebtoken\": \"^9.0.2\",\n    \"pg\": \"^8.14.1\",\n    \"uuid\": \"^11.1.0\"\n  }\n}\n\nCan somebody please tell , how to fix the bug ! i am unable to fix this since 48Hrs (Skill Issue)\n\nI have tried downgrading the Express version to 4 because ","ecosystem":"npm","package_name":"node.js","package_version":null,"solution":"Change the fallback router from\n\napp.all('*', (req, res, next) => {})\n\nto\n\napp.all('/{*any}', (req, res, next) => {})\n\nYou can find related resources at Moving to Express 5\n\nThe wildcard * must have a name, matching the behavior of parameters :, use /*splat instead of /*\n\n*splat matches any path without the root path. If you need to match the root path as well /, you can use /{*splat}, wrapping the wildcard in braces.","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/79553495/throw-new-typeerrormissing-parameter-name-at-i-debug-url","votes":18,"created_at":"2026-04-19T04:51:32.036502+00:00","updated_at":"2026-04-19T04:51:32.036502+00:00"}