Skip to content

Commit

Permalink
Inform user about incorrect query
Browse files Browse the repository at this point in the history
  • Loading branch information
WRadoslaw committed Oct 21, 2023
1 parent 56371b0 commit 484f829
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/server-extension/resolvers/AssetsResolver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,16 @@ export class AssetsResolver {

@FieldResolver(() => [String])
async resolvedUrls(@Root() object: StorageDataObject, @Ctx() ctx: Context): Promise<string[]> {
if (!object.storageBag) {
throw new Error(
'incorrect query: to use resolvedUrls make sure to add storageBag.id into query for StorageDataObject'
)
}
const clientLoc = await getClientLoc(ctx)
const limit = await getResolvedUrlsLimit(ctx)
// The resolvedUrl field is initially populated with the object ID
const [objectId] = object.resolvedUrls
if (!object.storageBag || !objectId) {
if (!object.storageBag?.id || !objectId) {
return []
}
const buckets = await distributionBucketsCache.getBucketsByBagId(object.storageBag.id)
Expand Down

0 comments on commit 484f829

Please sign in to comment.