Skip to content

TypeError: Cannot read properties of undefined (reading 'match') when accessing remote Cube definition with AsyncModule()Β #9347

@duncanm-dev

Description

@duncanm-dev

Describe the bug
When accessing one or more remote Cubes using asyncModule(), the server returns the following error (running in a Docker Container):

cube-1  | TypeError: Cannot read properties of undefined (reading 'match')
cube-1  |     at ClickHouseQuery.cubeSql (/cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/BaseQuery.js:1936:41)
cube-1  |     at /cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/PreAggregations.js:49:95
cube-1  |     at ClickHouseQuery.evaluateSymbolSqlWithContext (/cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/BaseQuery.js:2581:22)
cube-1  |     at PreAggregations.collectOriginalSqlPreAggregations (/cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/PreAggregations.js:1063:31)
cube-1  |     at /cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/PreAggregations.js:49:44
cube-1  |     at _map (/cube/node_modules/ramda/src/internal/_map.js:7:19)
cube-1  |     at map (/cube/node_modules/ramda/src/map.js:83:14)
cube-1  |     at /cube/node_modules/ramda/src/internal/_dispatchable.js:50:15
cube-1  |     at /cube/node_modules/ramda/src/internal/_curry2.js:26:18
cube-1  |     at f1 (/cube/node_modules/ramda/src/internal/_curry1.js:19:17)

The remote Cube definition is as follows:

  [
    {
      name: "sales",

      sql_table: "default.sales",
      data_source: "default",
      dimensions: {
        date: {
          sql: "date",
          type: "time",
        },
        revenue: {
          sql: "revenue",
          type: "number",
        },
        cpa: {
          sql: "cpa",
          type: "number",
        },
        distribution: {
          sql: "distribution",
          type: "number",
        },
      },
      measures: {
        count: {
          type: "count",
        },
        revenueAverage: {
          type: "avg",
          sql: "revenue",
        },
        revenueSum: {
          type: "sum",
          sql: "revenue",
        },
        cpaAverage: {
          type: "avg",
          sql: "cpa",
        },
        distributionAverageTest: {
          type: "sum",
          sql: "distribution",
        },
        distributionSum: {
          type: "sum",
          sql: "distribution",
        },
      },

      pre_aggregations: {}
    }
  ]

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Cube project using the provided Docker template.
  2. Create an asyncModule() Cube file in the src/cubes folder.
  3. Populate the file with the example in Cube's documentation replacing the URL we fetch with a remote JSON schema (or mock response) that matches the above.
  4. Start a Cube instance in a Docker container using docker compose up.
  5. See error in terminal, or access the Playground at http://localhost:4000 to see the error.

Expected behavior
That the Cube instance does not produce an error when being queried or accessed.

Version:
v1.2.21

Additional context
We are using the Clickhouse Connector.

Some attempts to fix this have been made, including:

  • Removing the preaggregations key.
  • Adding a preaggregations element to the output as per the documentation.
  • Removing the above.
  • Simplifying the schema.

Metadata

Metadata

Assignees

Labels

questionThe issue is a question. Please use Stack Overflow for questions.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions