hasura / hasura/graphql-engine

Snowflake data-connector-error

Open
#9,486 0 comments 0 reactions 0 assignees View on GitHub
k/bug t/data-connectors
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: [v2.20.0-cloud.1](https://cloud.hasura.io/project/fe11b154-4df4-4bc3-8005-39f174d05d1d/console/)

### Environment

Cloud

### What is the current behavior?

While executing queries to Snowflake through Hasura's GraphQL endpoint, the API returns a `data-connector-error` at some point.

### What is the expected behavior?

The API should consistently return the data without errors.

### How to reproduce the issue?

1. Connect to Snowflake DB, e.g., SNOWFLAKE_SAMPLE_DATA using the schema TPCDS_SF10TCL.
```
jdbc:snowflake://MYORGANIZATION-MYACCOUNT.snowflakecomputing.com/?user=MYUSER&warehouse=MYWAREHOUSE&db=MYDEMODB&schema=PUBLIC&password=MYPASSSWORD
```
2. Execute different queries to explore the dataset, e.g.,
```
query MyQuery {
DEMO_DB_PUBLIC_CUSTOMER {
C_EMAIL_ADDRESS
}
}
```
```
query MyQuery {
DEMO_DB_PUBLIC_ITEM_aggregate {
aggregate {
count(column: I_BRAND_ID)
}
}
}
```
3. Keep executing queries; sometimes, if you leave the API explorer inactive after completing a Query, it will stop working when you return and rerun it.

### Please provide any traces or logs that could help here.

Error log
```
{
"errors": [
{
"extensions": {
"code": "data-connector-error",
"internal": {
"stacktrace": "org.jooq.exception.DataAccessException: SQL [select object_construct_keep_null('aggregates', object_construct_keep_null('aggregate_count', count(\"I_BRAND_ID\"))) \"rows_and_aggregates\" from (select \"DEMO_DB\".\"PUBLIC\".\"ITEM\".*, row_number() over (order by true) \"rn\" from \"DEMO_DB\".\"PUBLIC\".\"ITEM\" where true order by \"rn\") \"ITEM_base_fields\"]; Authentication token has expired. The user must authenticate again.\n\tat org.jooq_3.18.0-SNAPSHOT.SNOWFLAKE.debug(Unknown Source)\n\tat org.jooq.impl.Tools.translate(Tools.java:3308)\n\tat org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:678)\n\tat org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:355)\n\tat org.jooq.impl.AbstractResultQuery.fetch(AbstractResultQuery.java:290)\n\tat io.hasura.services.dataConnectors.SnowflakeDataConnectorService$executeQuery$rows$1.invoke(SnowflakeDataConnectorService.kt:69)\n\tat io.hasura.services.dataConnectors.SnowflakeDataConnectorService$executeQuery$rows$1.invoke(SnowflakeDataConnectorService.kt:66)\n\tat io.hasura.utils.WithSpanKt.withSpan(WithSpan.kt:8)\n\tat io.hasura.services.dataConnectors.SnowflakeDataConnectorService.executeQuery(SnowflakeDataConnectorService.kt:66)\n\tat io.hasura.services.dataConnectors.BaseDataConnectorService.handleQuery(BaseDataConnectorService.kt:89)\n\tat io.hasura.controllers.DataConnectorResource.handleQuery(DataConnectorResource.kt:97)\n\tat io.hasura.controllers.DataConnectorResource$quarkusrestinvoker$handleQuery_8ced7de5f782b9f3d2e3867cfc09092d45e135bb.invoke(Unknown Source)\n\tat org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)\n\tat io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:114)\n\tat org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)\n\tat io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:564)\n\tat org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)\n\tat org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)\n\tat org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)\n\tat org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)\n\tat io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n\tat java.base/java.lang.Thread.run(Thread.java:833)\nCaused by: net.snowflake.client.jdbc.SnowflakeReauthenticationRequest: Authentication token has expired. The user must authenticate again.\n\tat net.snowflake.client.jdbc.SnowflakeUtil.checkErrorAndThrowExceptionSub(SnowflakeUtil.java:124)\n\tat net.snowflake.client.jdbc.SnowflakeUtil.checkErrorAndThrowExceptionIncludingReauth(SnowflakeUtil.java:63)\n\tat net.snowflake.client.core.SessionUtil.tokenRequest(SessionUtil.java:939)\n\tat net.snowflake.client.core.SessionUtil.renewSession(SessionUtil.java:854)\n\tat net.snowflake.client.core.SFSession.renewSession(SFSession.java:603)\n\tat net.snowflake.client.core.SFStatement.executeHelper(SFStatement.java:493)\n\tat net.snowflake.client.core.SFStatement.executeQueryInternal(SFStatement.java:196)\n\tat net.snowflake.client.core.SFStatement.executeQuery(SFStatement.java:133)\n\tat net.snowflake.client.core.SFStatement.execute(SFStatement.java:767)\n\tat net.snowflake.client.core.SFStatement.execute(SFStatement.java:677)\n\tat net.snowflake.client.jdbc.SnowflakeStatementV1.executeInternal(SnowflakeStatementV1.java:285)\n\tat net.snowflake.client.jdbc.SnowflakeStatementV1.execute(SnowflakeStatementV1.java:340)\n\tat io.agroal.pool.wrapper.StatementWrapper.execute(StatementWrapper.java:235)\n\tat io.opentelemetry.instrumentation.jdbc.internal.OpenTelemetryStatement.lambda$execute$5(OpenTelemetryStatement.java:84)\n\tat io.opentelemetry.instrumentation.jdbc.internal.OpenTelemetryStatement.wrapCall(OpenTelemetryStatement.java:292)\n\tat io.opentelemetry.instrumentation.jdbc.internal.OpenTelemetryStatement.execute(OpenTelemetryStatement.java:84)\n\tat org.jooq.tools.jdbc.DefaultStatement.execute(DefaultStatement.java:102)\n\tat org.jooq.impl.SettingsEnabledPreparedStatement.execute(SettingsEnabledPreparedStatement.java:227)\n\tat org.jooq.impl.Tools.executeStatementAndGetFirstResultSet(Tools.java:4563)\n\tat org.jooq.impl.AbstractResultQuery.execute(AbstractResultQuery.java:236)\n\tat org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:341)\n\t... 18 more\n"
},
"path": "$"
},
"message": "UncaughtError: SQL [select object_construct_keep_null('aggregates', object_construct_keep_null('aggregate_count', count(\"I_BRAND_ID\"))) \"rows_and_aggregates\" from (select \"DEMO_DB\".\"PUBLIC\".\"ITEM\".*, row_number() over (order by true) \"rn\" from \"DEMO_DB\".\"PUBLIC\".\"ITEM\" where true order by \"rn\") \"ITEM_base_fields\"]; Authentication token has expired. The user must authenticate again."
}
]
}
```

### Any possible solutions/workarounds you're aware of?

It works if I remove the Database from Hasura and add it again.

### Keywords

snowflake database

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.