lissy93/web-check · error · Error
URL is missing from queryStringParameters
Error message
URL is missing from queryStringParameters
What it means
screenshotHandler requires the target URL as its first argument; when the argument is falsy it throws before any validation runs. The name references AWS API Gateway's queryStringParameters object, indicating this handler is wired to a ?url= query parameter that was absent from the request.
Source
Thrown at api/screenshot.js:73
});
const page = await browser.newPage();
await page.emulateMediaFeatures([{ name: 'prefers-color-scheme', value: 'dark' }]);
page.setDefaultNavigationTimeout(8000);
await page.goto(targetUrl, { waitUntil: 'domcontentloaded' });
await page.evaluate(() => {
if (!document.querySelector('body')) {
throw new Error('No body element found on the page');
}
});
const buffer = await page.screenshot();
return buffer.toString('base64');
} finally {
if (browser) await browser.close().catch(() => {});
}
};
const screenshotHandler = async (targetUrl) => {
if (!targetUrl) throw new Error('URL is missing from queryStringParameters');
try {
new URL(targetUrl);
} catch {
throw new Error('URL provided is invalid');
}
log.debug(`request received: ${targetUrl}`);
try {
return { image: await directChromiumScreenshot(targetUrl) };
} catch (directError) {
log.warn(`direct chromium failed, falling back to puppeteer: ${directError.message}`);
}
try {
return { image: await puppeteerScreenshot(targetUrl) };
} catch (error) {
if (/ENOENT|Browser was not found|Could not find Chromium/i.test(error.message)) {
return { skipped: error.message };
}View on GitHub (pinned to af1a97759f)
Solutions
- Add ?url=<full URL including scheme> to the request
- Check the request mapping: confirm the param is read from the correct location (req.query.url vs event.queryStringParameters.url)
- Return a 400 with guidance from your wrapper when the param is missing instead of letting it bubble as 500
Example fix
// before
fetch('/api/screenshot'); // 500: URL is missing from queryStringParameters
// after
fetch(`/api/screenshot?url=${encodeURIComponent('https://example.com')}`); Defensive patterns
Strategy: validation
Validate before calling
const urlParam = req.query.url;
if (!urlParam) return res.status(400).json({ error: 'url query parameter is required' });
const image = await screenshotHandler(urlParam); Type guard
const hasUrlParam = (q) => Object.prototype.hasOwnProperty.call(q, 'url') && typeof q.url === 'string' && q.url.length > 0;
Try / catch
try { await screenshotHandler(q.url); }
catch (e) {
if (/missing from queryStringParameters/.test(e.message)) return badRequest('add ?url=...');
throw e;
} Prevention
- Validate required query params in a shared request guard before handlers run
- Return 400, not 500, for caller mistakes
- Add contract tests hitting the endpoint without params to catch wiring regressions
When it happens
Trigger: GET /api/screenshot with no ?url parameter; the integration/handler mapping fails to extract queryStringParameters.url and passes undefined.
Common situations: Frontend forgetting to append the query param, serverless function URL vs API Gateway param-shape mismatch, or env-specific routing that drops query strings.
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
- No target provided
- URL provided is invalid
- You must provide a URL query parameter!
- No URL specified
- Invalid URL format
AI-assisted analysis of lissy93/web-check@af1a97759f (2026-08-27).
Data as JSON: /api/errors/617646a331fb7243.
Report an issue: GitHub.