Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Bad page number in url results in 500 #1492

Closed
danielbeardsley opened this issue Mar 21, 2023 · 0 comments · Fixed by #1503
Closed

Bad page number in url results in 500 #1492

danielbeardsley opened this issue Mar 21, 2023 · 0 comments · Fixed by #1503
Assignees
Labels
0 bug Something isn't working

Comments

@danielbeardsley
Copy link
Member

Problem

We had several thousand of these errors over the weekend (there's a separate issue for figuring out why they weren't sent to sentry). Bad input (page numbers in this case) should not result in a 500 response, nor a notice to us.

START RequestId: 30b245bf-3743-46ee-85fa-8e1369d37e5f Version: $LATEST
2023-03-21T09:31:16.944Z	undefined	INFO	info  - Loaded env from /var/task/frontend/.env.production
2023-03-21T09:31:21.518Z	30b245bf-3743-46ee-85fa-8e1369d37e5f	INFO	context.resolvedUrl /Parts/MacBook_Pro/Display_Components?p=-1%20OR%203%2B947-947-1%3D0%2B0%2B0%2B1
2023-03-21T09:31:21.518Z	30b245bf-3743-46ee-85fa-8e1369d37e5f	INFO	context.req.url /Parts/MacBook_Pro/Display_Components?p=-1%20OR%203%2B947-947-1%3D0%2B0%2B0%2B1
2023-03-21T09:31:21.566Z	30b245bf-3743-46ee-85fa-8e1369d37e5f	INFO	iFixit API GET:cart/part_collections/devices/MacBook_Pro => 26.58ms
2023-03-21T09:31:21.576Z	30b245bf-3743-46ee-85fa-8e1369d37e5f	INFO	Cache miss for 'storeList' => 50.20ms
2023-03-21T09:31:21.579Z	30b245bf-3743-46ee-85fa-8e1369d37e5f	INFO	Cache miss for 'globalSettings' => 60.11ms
2023-03-21T09:31:21.604Z	30b245bf-3743-46ee-85fa-8e1369d37e5f	INFO	strapi.getProductList => 66.13ms
2023-03-21T09:31:21.622Z	30b245bf-3743-46ee-85fa-8e1369d37e5f	INFO	algolia.findDescendantDevicesWithProducts => 14.38ms
2023-03-21T09:31:21.622Z	30b245bf-3743-46ee-85fa-8e1369d37e5f	INFO	findProductList => 84.63ms
2023-03-21T09:31:22.217Z	30b245bf-3743-46ee-85fa-8e1369d37e5f	INFO	Cache miss for 'store-us' => 689.23ms
2023-03-21T09:31:22.217Z	30b245bf-3743-46ee-85fa-8e1369d37e5f	INFO	layoutProps => 698.39ms
2023-03-21T09:31:22.520Z	30b245bf-3743-46ee-85fa-8e1369d37e5f	ERROR	Unhandled Promise Rejection 	{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"ApiError: Value too small for \"page\" parameter, expected integer between 0 and 9223372036854775807","trace":["Runtime.UnhandledPromiseRejection: ApiError: Value too small for \"page\" parameter, expected integer between 0 and 9223372036854775807","    at process.<anonymous> (file:///var/runtime/index.mjs:1188:17)","    at process.emit (node:events:525:35)","    at process.emit (node:domain:489:12)","    at emit (node:internal/process/promises:140:20)","    at processPromiseRejections (node:internal/process/promises:274:27)","    at processTicksAndRejections (node:internal/process/task_queues:97:32)"]}
Unknown application error occurred
Runtime.Unknown
END RequestId: 30b245bf-3743-46ee-85fa-8e1369d37e5f
REPORT RequestId: 30b245bf-3743-46ee-85fa-8e1369d37e5f	Duration: 6171.92 ms	Billed Duration: 6172 ms	Memory Size: 1024 MB	Max Memory Used: 203 MB

Do This

  • Respond with a 4xx status code or completely ignore the parameter (whatever is easier) when it doesn't validate
  • Bonus: look around and see if there are other instances of the same problem (un-validated input from query params)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
0 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants