[superlog] Accept null values in website settings and integrations output schema#542
[superlog] Accept null values in website settings and integrations output schema#542superlog-app[bot] wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
The latest updates on your projects. Learn more about Unkey Deploy
|
Greptile SummaryThis PR fixes an output-validation crash in
Confidence Score: 5/5Safe to merge — the change is a targeted schema relaxation on output-only validation with no effect on data writes or input validation. The fix is correct and minimal. All downstream consumers of WebsiteOutput already guard against both null and undefined. No input schemas are touched, so write paths are unaffected. No files require special attention. The single changed file has a well-understood and isolated fix. Important Files Changed
Reviews (1): Last reviewed commit: "[superlog] Accept null values in website..." | Re-trigger Greptile |
Summary
Users calling
websites.transferToOrganizationreceive anInternal Server Erroron every attempt, even though the database UPDATE succeeds and the website is transferred. The error is caused by oRPC's output validation rejecting the returnedWebsiteobject when the website'ssettingsJSONB field has a property explicitly set tonull(e.g.,{"allowedOrigins": null}).websiteSettingsSchemaused.optional()for each inner field, which Zod 4 maps toT | undefined— it does not acceptnull. A JSONB column that stores{"allowedOrigins": null}in PostgreSQL delivers thatnullvalue at runtime, causing the schema to throw"expected array, received null". Because oRPC validates the handler's return value in a microtask after the async handler resolves, the resultingORPCError(INTERNAL_SERVER_ERROR)carries only oRPC stack frames (no user-land frames), which is how the error was identified as an output-validation failure rather than a thrown exception from user code.This patch changes each inner settings field from
.optional()to.nullish()(accepting bothundefinedandnull), changes the outer type from.nullable()to.nullish(), and defensively applies the same tointegrations. No existing valid-data behaviour changes — null and undefined are both accepted, valid arrays still validate normally.An alternative approach would be to sanitize the JSONB data at write-time (disallowing null-valued optional fields in the
updateWebsiteSettingshandler) or to add a migration that cleans existing null values. The schema fix chosen here is lower-risk and immediately unblocks affected users.Incident on Superlog
Was this PR helpful? Leave feedback — goes straight to the Superlog team.
Summary by cubic
Fixes Internal Server Error from oRPC output validation when website settings or integrations contain null values. Endpoints returning
Website(e.g.,websites.transferToOrganization) no longer fail on nulls.websiteSettingsSchemato.nullish()and the outer object to.nullish().integrationsinwebsiteOutputSchemato.nullish().nullandundefined; valid arrays/booleans still validate normally.Written for commit b85423b. Summary will update on new commits.