tableau / connector-plugin-sdk

SDK for Developing Tableau Connector Plugins
https://tableau.github.io/connector-plugin-sdk/
MIT License
108 stars 107 forks source link

[BUG] Auth errors ignored without init sql #902

Closed nineinchnick closed 2 years ago

nineinchnick commented 2 years ago

Describe the bug When opening up a new connection, authentication errors are ignored and no error dialog is being displayed, unless any query (like SELECT 1) is added in the Initial SQL field.

Screenshots Without any initial SQL:

Screenshot 2021-12-06 at 12 20 18

After adding some initial SQL:

Screenshot 2021-12-06 at 12 19 30

The relevant part of jprotocolserver.log file, without any initial SQL (redacted hostnames and usernames):

2021-12-06 12:07:47.264 +0100 (,,,,,) main : INFO  com.tableau.connect.grpc.GrpcProtocolServer - Grpc started, listening on 50146.
2021-12-06 12:07:47.264 +0100 (,,,,,) main : INFO  com.tableau.connect.grpc.GrpcProtocolServer - Protocol Server InetAddress HostAddress=192.168.3.63 , CanonicalHostName=janmac , HostName=janmac
2021-12-06 12:07:47.266 +0100 (,,,,,) main : INFO  com.tableau.connect.grpc.GrpcProtocolServer - Wrote endpoint to file /var/folders/vv/2x51cmd13kngjmphzn9zfp0h0000gn/T/tableau-temp/TEMP_1l4b3la1c63uej1c0omy11ak3cah.tmp
2021-12-06 12:07:47.420 +0100 (,,,,2,1) grpc-default-executor-1 : INFO  com.tableau.connect.grpc.GrpcProtocolService - Start local request 1 /constructProtocol.
2021-12-06 12:07:47.434 +0100 (,,,,2,1) grpc-default-executor-1 : INFO  com.tableausoftware.jdbc.JDBCDriverManager - Loading drivers from classpath.
2021-12-06 12:07:47.435 +0100 (,,,,2,1) grpc-default-executor-1 : INFO  com.tableausoftware.jdbc.JDBCDriverManager - Loading isolated drivers from :/Users/jwas/Library/Tableau/Drivers/trino-jdbc-365.jar
2021-12-06 12:07:47.436 +0100 (,,,,2,1) grpc-default-executor-1 : INFO  com.tableausoftware.jdbc.JDBCDriverManager - Created classloader for file:/Users/jwas/Library/Tableau/Drivers/trino-jdbc-365.jar
2021-12-06 12:07:47.488 +0100 (,,,,2,1) grpc-default-executor-1 : INFO  com.tableausoftware.jdbc.JDBCDriverManager - Loaded io.trino.jdbc.TrinoDriver from file:/Users/jwas/Library/Tableau/Drivers/trino-jdbc-365.jar
2021-12-06 12:07:47.491 +0100 (,,,,2,1) grpc-default-executor-1 : INFO  com.tableausoftware.jdbc.StubDriver - Registered StubDriver.
2021-12-06 12:07:47.499 +0100 (,,,,2,1) grpc-default-executor-1 : INFO  com.tableausoftware.jdbc.JDBCDriverManager - Get driver from isolatedDrivers.
2021-12-06 12:07:47.502 +0100 (,,,,2,1) grpc-default-executor-1 : INFO  com.tableausoftware.jdbc.JDBCProtocolImpl - Connecting to jdbc:trino://example.invalid:443/?
2021-12-06 12:07:47.502 +0100 (,,,,2,1) grpc-default-executor-1 : INFO  com.tableausoftware.jdbc.JDBCProtocolImpl - Connection properties {password=*******, SSLVerification=*******, source=*******, SSL=true, user=jwas}
2021-12-06 12:07:47.537 +0100 (,,,,2,1) grpc-default-executor-1 : INFO  com.tableausoftware.jdbc.JDBCDriverManager - Connected using driver {io.trino.jdbc.TrinoDriver} from isolatedDriver.
2021-12-06 12:07:48.887 +0100 (,,,,2,1) grpc-default-executor-1 : ERROR com.tableau.connect.service.ProtocolService - Error in getting the server version string, still trying to connect.
2021-12-06 12:07:48.891 +0100 (,,,,2,1) grpc-default-executor-1 : INFO  com.tableau.connect.grpc.GrpcProtocolService - End local request 1 /constructProtocol.
2021-12-06 12:07:48.893 +0100 (,,,,2,2) grpc-default-executor-1 : INFO  com.tableau.connect.grpc.GrpcProtocolService - Start local request 2 /setCapability.
2021-12-06 12:07:48.894 +0100 (,,,,2,2) grpc-default-executor-1 : INFO  com.tableau.connect.grpc.GrpcProtocolService - End local request 2 /setCapability.
2021-12-06 12:07:48.895 +0100 (,,,,2,3) grpc-default-executor-1 : INFO  com.tableau.connect.grpc.GrpcProtocolService - Start local request 3 /setCapability.
2021-12-06 12:07:48.895 +0100 (,,,,2,3) grpc-default-executor-1 : INFO  com.tableau.connect.grpc.GrpcProtocolService - End local request 3 /setCapability.
2021-12-06 12:07:49.077 +0100 (,,,,2,4) grpc-default-executor-1 : INFO  com.tableau.connect.grpc.GrpcProtocolService - Start local request 4 /enumerateNames.
2021-12-06 12:07:49.638 +0100 (,,,,2,4) grpc-default-executor-1 : ERROR com.tableausoftware.jdbc.JDBCProtocolImpl - Exception in getCatalogs: Authentication failed: 
2021-12-06 12:07:49.649 +0100 (,,,,2,4) grpc-default-executor-1 : INFO  com.tableau.connect.grpc.GrpcProtocolService - End local request 4 /enumerateNames.

And after adding an initial SQL:

2021-12-06 12:13:42.770 +0100 (,,,,4,7) grpc-default-executor-3 : ERROR com.tableau.connect.service.ProtocolService - Error in getting the server version string, still trying to connect.
2021-12-06 12:13:42.771 +0100 (,,,,4,7) grpc-default-executor-3 : INFO  com.tableau.connect.grpc.GrpcProtocolService - End local request 7 /constructProtocol.
2021-12-06 12:13:42.775 +0100 (,,,,4,8) grpc-default-executor-3 : INFO  com.tableau.connect.grpc.GrpcProtocolService - Start local request 8 /setCapability.
2021-12-06 12:13:42.775 +0100 (,,,,4,8) grpc-default-executor-3 : INFO  com.tableau.connect.grpc.GrpcProtocolService - End local request 8 /setCapability.
2021-12-06 12:13:42.777 +0100 (,,,,4,9) grpc-default-executor-3 : INFO  com.tableau.connect.grpc.GrpcProtocolService - Start local request 9 /setCapability.
2021-12-06 12:13:42.778 +0100 (,,,,4,9) grpc-default-executor-3 : INFO  com.tableau.connect.grpc.GrpcProtocolService - End local request 9 /setCapability.
2021-12-06 12:13:42.780 +0100 (,,,,4,10) grpc-default-executor-3 : INFO  com.tableau.connect.grpc.GrpcProtocolService - Start local request 10 /runQuery.
2021-12-06 12:13:42.781 +0100 (,,,,4,10) grpc-default-executor-3 : INFO  com.tableau.connect.service.ProtocolService - Running query 
   select 1
2021-12-06 12:13:42.784 +0100 (,,,,4,10) grpc-default-executor-3 : INFO  com.tableau.connect.grpc.GrpcProtocolService - End local request 10 /runQuery.
2021-12-06 12:13:43.382 +0100 (,,,,4,10) pool-3-thread-1 : ERROR com.tableausoftware.jdbc.JDBCProtocolImpl - Exception Authentication failed:  for query: 
   select 1
2021-12-06 12:13:43.383 +0100 (,,,,4,10) pool-3-thread-1 : ERROR com.tableau.connect.service.QueryTask - Query for protocol 4 exiting with error class java.sql.SQLException

Desktop (please complete the following information):

About you: Name: Jan Waś Company: Starburst Data

leniartek commented 2 years ago

cc. @VasanthiNeelagiri

jie-d commented 2 years ago

Internal tracking id: 1352821

VasanthiNeelagiri commented 2 years ago

Thanks for raising the ticket and letting us know about this issue. This is a known issue and our development team is investigating it internally.

Here's a KB Article - https://kb.tableau.com/articles/issue/presto-jdbc-connector-does-not-present-error-message-for-connection-failures

rosswbrown commented 2 years ago

In the upcoming Tableau 2022.2 release a new capability CAP_FORCE_CONNECTION_VERIFICATION has been added to help mitigate this behavior in the underlying data source. Documentation PR is linked for reference.

You can update your connector to include CAP_FORCE_CONNECTION_VERIFICATION if desired to force a probe query during initial connection.

Watch https://tableau.github.io/connector-plugin-sdk/news/ for notification of general availability of this change.