lissy93/web-check · error · Error

You must provide a URL query parameter!

Error message

You must provide a URL query parameter!

What it means

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.

Source

Thrown at api/status.js:8

import https from 'https';
import { performance, PerformanceObserver } from 'perf_hooks';
import middleware from './_common/middleware.js';
import { UA } from './_common/http.js';

const statusHandler = async (url) => {
  if (!url) {
    throw new Error('You must provide a URL query parameter!');
  }

  let dnsLookupTime;
  let responseCode;
  let startTime;

  const obs = new PerformanceObserver((items) => {
    dnsLookupTime = items.getEntries()[0].duration;
    performance.clearMarks();
  });

  obs.observe({ entryTypes: ['measure'] });

  performance.mark('A');

  try {
    startTime = performance.now();
    const response = await new Promise((resolve, reject) => {

View on GitHub (pinned to af1a97759f)

Solutions

  1. Append ?url=https://example.com to the request
  2. Verify the caller reads the parameter from the right request object shape
  3. Guard client-side: disable submit until a non-empty URL is entered

Example fix

// before
fetch('/api/status'); // You must provide a URL query parameter!

// after
fetch(`/api/status?url=${encodeURIComponent('https://example.com')}`);
Defensive patterns

Strategy: validation

Validate before calling

const url = req.query.url;
if (!url) return res.status(400).json({ error: 'url query parameter is required' });
const status = await statusHandler(url);

Type guard

const isNonEmptyString = (v) => typeof v === 'string' && v.trim().length > 0;

Try / catch

try { await statusHandler(url); }
catch (e) {
  if (e.message.includes('provide a URL query parameter')) return badRequest('add ?url=...');
  throw e;
}

Prevention

When it happens

Trigger: Invoking the status endpoint/function with no ?url query parameter, or with an empty ?url= value.

Common situations: 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.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


AI-assisted analysis of lissy93/web-check@af1a97759f (2026-08-27). Data as JSON: /api/errors/35e571dbdabfaf4a. Report an issue: GitHub.