fix(presigned-url): codec table name matching + ownerId type resolution#1073
Merged
pyramation merged 2 commits intomainfrom May 8, 2026
Merged
fix(presigned-url): codec table name matching + ownerId type resolution#1073pyramation merged 2 commits intomainfrom
pyramation merged 2 commits intomainfrom
Conversation
resolveStorageConfigFromCodec was using pgCodec.name (inflected codec name, e.g. 'appBuckets') instead of pgCodec.extensions.pg.name (raw SQL table name, e.g. 'app_buckets'). The metaschema stores raw SQL table names, so the match always failed → STORAGE_MODULE_NOT_FOUND.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Use build.getGraphQLTypeByPgCodec() to resolve the ownerId argument type from the codec's owner_id attribute (e.g. UUID scalar) instead of hardcoding GraphQLString. Grafast uses referential equality for type matching, so $ownerId: UUID! failed against String!.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two fixes to the presigned-url plugin's mutation entry points (added in PR #1071 / #1072):
1. Use raw SQL table name for codec-to-storage-module lookup
resolveStorageConfigFromCodecwas comparingpgCodec.nameagainst metaschema table names (bucketsTableName/filesTableName). In PostGraphile v5,pgCodec.nameis the inflected codec name (set viainflection.classCodecName(), e.g.appBuckets), while metaschema stores the raw SQL table name (e.g.app_buckets). The raw name is available atpgCodec.extensions.pg.name(set frompgClass.relnameinPgCodecsPlugin).This mismatch caused
STORAGE_MODULE_NOT_FOUNDerrors wheneverrequestUploadUrlorrequestBulkUploadUrlswas called through the mutation entry points.The fix reads from
extensions.pg.namewith a fallback topgCodec.namefor backward compatibility.2. Resolve ownerId argument type from codec attribute
The
ownerIdmutation argument was hardcoded asGraphQLString. For codecs whereowner_idis a UUID column, Grafast's type matching (referential equality via===) rejects$ownerId: UUID!variables becauseGraphQLString !== UUIDscalar.The fix uses
build.getGraphQLTypeByPgCodec(codec.attributes.owner_id.codec, 'input')to resolve the correct GraphQL scalar type from the codec's attribute definition, with a fallback toGraphQLStringif the lookup returns null.Related: This unblocks constructive-db PR #1054 which rewrites the minio-multi-scope integration tests to use the per-bucket mutation API.
Review & Testing Checklist for Human
getGraphQLTypeByPgCodecreturns the expected UUID scalar — the call uses(build as any)to bypass TypeScript; confirm at runtime thatownerIdTyperesolves to the UUID scalar (not null) for entity-scoped bucket codecscodec.attributes.owner_id.codecaccess is safe — it's guarded byhasOwnerId = !!codec.attributes.owner_id, but verify that the.codecsub-property is always present on attribute definitions$ownerId: UUID!(notString!) — this plugin has no local tests for either fixpgCodec.nameusages inplugin.tsandstorage-module-cache.tsto check for similar raw-vs-inflected mismatchesNotes
resolveStorageConfigFromCodecwas updated to includename?: stringin thepgextension type so TypeScript knows about the field.ownerIdTypefallback (|| GraphQLString) preserves the old behavior ifgetGraphQLTypeByPgCodecreturns null for any reason.extensions.pg.namefallback usespgCodec.name, and theownerIdTypefallback usesGraphQLString.Link to Devin session: https://app.devin.ai/sessions/7903d2a3e7a34c6daa605e12d6b80d9e
Requested by: @pyramation