{"record":{"id":"35e571dbdabfaf4a","repo":"lissy93/web-check","slug":"you-must-provide-a-url-query-parameter","errorCode":null,"errorMessage":"You must provide a URL query parameter!","messagePattern":"You must provide a URL query parameter!","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"api/status.js","lineNumber":8,"sourceCode":"import https from 'https';\nimport { performance, PerformanceObserver } from 'perf_hooks';\nimport middleware from './_common/middleware.js';\nimport { UA } from './_common/http.js';\n\nconst statusHandler = async (url) => {\n  if (!url) {\n    throw new Error('You must provide a URL query parameter!');\n  }\n\n  let dnsLookupTime;\n  let responseCode;\n  let startTime;\n\n  const obs = new PerformanceObserver((items) => {\n    dnsLookupTime = items.getEntries()[0].duration;\n    performance.clearMarks();\n  });\n\n  obs.observe({ entryTypes: ['measure'] });\n\n  performance.mark('A');\n\n  try {\n    startTime = performance.now();\n    const response = await new Promise((resolve, reject) => {","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/lissy93/web-check/blob/af1a97759fc8bcc43c876c94f2ccb018ce215f90/api/status.js#L1-L26","documentation":"statusHandler, which measures DNS lookup time and HTTP response timing, requires the url argument and throws immediately when falsy. This is the standard missing-query-parameter guard for the status endpoint.","triggerScenarios":"Invoking the status endpoint/function with no ?url query parameter, or with an empty ?url= value.","commonSituations":"Missing query param in the request URL, caller reading the wrong param key, or an integration (API Gateway vs Vercel function) that places query params in a different structure.","solutions":["Append ?url=https://example.com to the request","Verify the caller reads the parameter from the right request object shape","Guard client-side: disable submit until a non-empty URL is entered"],"exampleFix":"// before\nfetch('/api/status'); // You must provide a URL query parameter!\n\n// after\nfetch(`/api/status?url=${encodeURIComponent('https://example.com')}`);","handlingStrategy":"validation","validationCode":"const url = req.query.url;\nif (!url) return res.status(400).json({ error: 'url query parameter is required' });\nconst status = await statusHandler(url);","typeGuard":"const isNonEmptyString = (v) => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":"try { await statusHandler(url); }\ncatch (e) {\n  if (e.message.includes('provide a URL query parameter')) return badRequest('add ?url=...');\n  throw e;\n}","preventionTips":["Guard at the request boundary with 400 responses for missing params","Disable caller actions until a URL is entered","Use one shared query-param extraction helper across endpoints"],"tags":["validation","query-parameter","status","api"],"backgroundTag":"missing-required-parameter","analyzedSha":"af1a97759fc8bcc43c876c94f2ccb018ce215f90","analyzedAt":"2026-08-27T11:44:27.410Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}