From e8843dc318391fcc05dcac7a3c494e2dbf080c25 Mon Sep 17 00:00:00 2001 From: Brian Sigafoos <142952121+BrianSigafoos-SQ@users.noreply.github.com> Date: Mon, 20 Jul 2026 07:07:29 -0400 Subject: [PATCH 1/2] fix(schema-compiler): Throw UserError for unknown granularity so API returns 400, thanks @BrianSigafoos-SQ (#11288) An unknown granularity in a time dimension (e.g. granularity: "all") is a client input error, but it was thrown as a plain Error, which the API gateway reports as HTTP 500 Internal Server Error. Throw UserError instead so the REST API returns 400 like other invalid-query errors. Ai-assisted: true Co-authored-by: Claude Code --- .../src/adapter/Granularity.ts | 3 ++- .../test/unit/base-query.test.ts | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/packages/cubejs-schema-compiler/src/adapter/Granularity.ts b/packages/cubejs-schema-compiler/src/adapter/Granularity.ts index bf3260f040cb8..4e7d452fd6d99 100644 --- a/packages/cubejs-schema-compiler/src/adapter/Granularity.ts +++ b/packages/cubejs-schema-compiler/src/adapter/Granularity.ts @@ -10,6 +10,7 @@ import { timeSeriesFromCustomInterval, TimeSeriesOptions } from '@cubejs-backend/shared'; +import { UserError } from '../compiler/UserError'; import { BaseQuery } from './BaseQuery'; export class Granularity { @@ -44,7 +45,7 @@ export class Granularity { ); if (!customGranularity) { - throw new Error(`Granularity "${timeDimension.granularity}" does not exist in dimension ${timeDimension.dimension}`); + throw new UserError(`Granularity "${timeDimension.granularity}" does not exist in dimension ${timeDimension.dimension}`); } this.granularityInterval = customGranularity.interval; diff --git a/packages/cubejs-schema-compiler/test/unit/base-query.test.ts b/packages/cubejs-schema-compiler/test/unit/base-query.test.ts index 63a9f0bd91735..f575e562453a9 100644 --- a/packages/cubejs-schema-compiler/test/unit/base-query.test.ts +++ b/packages/cubejs-schema-compiler/test/unit/base-query.test.ts @@ -863,6 +863,27 @@ describe('SQL Generation', () => { } }); + it('throws UserError for unknown granularity', async () => { + await compilers.compiler.compile(); + + const buildQuery = () => new PostgresQuery(compilers, { + measures: ['orders.count'], + timeDimensions: [ + { + dimension: 'orders.createdAt', + granularity: 'all', + dateRange: ['2020-01-01', '2021-12-31'] + } + ], + dimensions: [], + filters: [], + timezone: 'Europe/Kyiv' + }); + + expect(buildQuery).toThrow(UserError); + expect(buildQuery).toThrow('Granularity "all" does not exist in dimension orders.createdAt'); + }); + describe('via PostgresQuery', () => { beforeAll(async () => { await compilers.compiler.compile(); From dafaf9b4c513a18b50d2cf4056fd2488bb263026 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jul 2026 13:08:46 +0200 Subject: [PATCH 2/2] chore: Bump websocket-driver from 0.7.4 to 0.7.5 (#11266) Bumps [websocket-driver](https://github.com/faye/websocket-driver-node) from 0.7.4 to 0.7.5. - [Changelog](https://github.com/faye/websocket-driver-node/blob/main/CHANGELOG.md) - [Commits](https://github.com/faye/websocket-driver-node/compare/0.7.4...0.7.5) --- updated-dependencies: - dependency-name: websocket-driver dependency-version: 0.7.5 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 515b7797039cb..ac3024627d4b3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24662,9 +24662,9 @@ webpack@5.94.0: webpack-sources "^3.2.3" websocket-driver@>=0.5.1, websocket-driver@^0.7.4: - version "0.7.4" - resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.4.tgz#89ad5295bbf64b480abcba31e4953aca706f5760" - integrity sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg== + version "0.7.5" + resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.5.tgz#569d22764ab21f2de20af0e74b411e8ae5a0fa46" + integrity sha512-ZL2+3c7kMBdIRCMz6l8jQMHyGVxj+UL+xVk74Ombiciboca8rHa15L86B19E5oh1pL9Ii/uj54gtsIrZGMo6zA== dependencies: http-parser-js ">=0.5.1" safe-buffer ">=5.1.0"