zenstack
zenstack copied to clipboard
Invalid compound IDs lead to 400, should be 404
Description and expected behavior In case of using a compound ID on a model, a 400 error is returned when the supplied ID is missing chunks for any column.
ie. if the correct URL for a resource is /user/a_b on a constraint with 2 columns, when /user/a is called it leads to a 400 due to an error thrown from prisma.findUnique() receiving undefined in the where filter.
Screenshots
Environment (please complete the following information):
- ZenStack version: 2.17.2
- Prisma version: 6.10.0
- Database type: MariaDB
Additional context Issue was initially discovered in https://github.com/zenstackhq/zenstack/pull/2188
Some tentative approaches for fixes https://github.com/zenstackhq/zenstack/pull/2188#issuecomment-3163705895