syndesis: SQL query validation fails with unable to fetch metadata
This is a…
[ ] Feature request
[x] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Documentation issue or request
The problem
After submitting invalid query I’ able to proceed further. The response from syndesis-meta
doesn’t seem right.
Payload
{"query":"SELECT * FROM CONTACT-A","schedulerExpression":"1000"}
Response
{
"componentScheme": "sql",
"connectorCustomizers": [
"io.syndesis.connector.sql.customizer.SqlStartConnectorCustomizer"
],
"inputDataShape": {
"kind": "none"
},
"outputDataShape": {
"kind": "json-schema"
},
"propertyDefinitionSteps": [
{
"description": "Enter a SQL statement that starts with SELECT.",
"name": "SQL statement",
"properties": {
"query": {
"deprecated": false,
"labelHint": "SQL SELECT statement to be executed.",
"displayName": "SQL statement",
"group": "common",
"javaType": "java.lang.String",
"kind": "path",
"required": true,
"secret": false,
"type": "string"
},
"schedulerExpression": {
"defaultValue": "1000",
"deprecated": false,
"labelHint": "Delay in milliseconds between scheduling (executing).",
"displayName": "Period",
"group": "consumer",
"javaType": "long",
"kind": "parameter",
"required": false,
"secret": false,
"type": "duration"
}
}
}
],
"split": {},
"_meta": {
"message": "Unable to fetch and process metadata",
"type": "DANGER"
}
}
syndesis-meta log
2018-03-09 18:50:25.297 ERROR 1 --- [ XNIO-3 task-10] i.s.connector.meta.v1.VerifierEndpoint : Unable to fetch and process metadata for connector: sql, action: sql-start-connector
--
| 2018-03-09 18:50:25.303 ERROR 1 --- [ XNIO-3 task-10] i.s.c.meta.VerifierExceptionMapper : Exception while handling request: POST /api/v1/connectors/sql/actions/sql-start-connector
|
| io.syndesis.common.util.SyndesisServerException: Unable to fetch and process metadata
| at io.syndesis.connector.support.verifier.api.MetadataRetrieval.handle(MetadataRetrieval.java:42) ~[connector-support-verifier-1.3-SNAPSHOT.jar!/:1.3-SNAPSHOT]
| at io.syndesis.connector.meta.v1.ConnectorEndpoint.actions(ConnectorEndpoint.java:87) ~[classes!/:1.3-SNAPSHOT]
| at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source) ~[na:na]
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
| at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
| at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140) ~[resteasy-jaxrs-3.1.4.Final.jar!/:3.1.4.Final]
| at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:294) ~[resteasy-jaxrs-3.1.4.Final.jar!/:3.1.4.Final]
| at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:248) ~[resteasy-jaxrs-3.1.4.Final.jar!/:3.1.4.Final]
| at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:235) ~[resteasy-jaxrs-3.1.4.Final.jar!/:3.1.4.Final]
| at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:402) [resteasy-jaxrs-3.1.4.Final.jar!/:3.1.4.Final]
| at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:209) [resteasy-jaxrs-3.1.4.Final.jar!/:3.1.4.Final]
| at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:227) [resteasy-jaxrs-3.1.4.Final.jar!/:3.1.4.Final]
| at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [resteasy-jaxrs-3.1.4.Final.jar!/:3.1.4.Final]
| at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [resteasy-jaxrs-3.1.4.Final.jar!/:3.1.4.Final]
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api-3.1.0.jar!/:3.1.0]
| at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) [spring-boot-1.5.8.RELEASE.jar!/:1.5.8.RELEASE]
| at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
| at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at org.springframework.web.filter.AbstractRequestLoggingFilter.doFilterInternal(AbstractRequestLoggingFilter.java:244) [spring-web-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
| at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
| at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:110) [spring-boot-actuator-1.5.8.RELEASE.jar!/:1.5.8.RELEASE]
| at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
| at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
| at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
| at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108) [spring-web-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
| at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
| at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) [spring-web-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
| at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
| at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
| at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
| at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106) [spring-boot-actuator-1.5.8.RELEASE.jar!/:1.5.8.RELEASE]
| at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
| at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:64) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) [undertow-core-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) [undertow-core-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) [undertow-core-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104) [undertow-servlet-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.server.Connectors.executeRootHandler(Connectors.java:332) [undertow-core-1.4.20.Final.jar!/:1.4.20.Final]
| at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:812) [undertow-core-1.4.20.Final.jar!/:1.4.20.Final]
| at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]
| at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]
| at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]
| Caused by: java.lang.IllegalStateException: org.postgresql.util.PSQLException: ERROR: syntax error at or near "-"
| Position: 22
| at io.syndesis.connector.sql.SqlConnectorMetaDataExtension.meta(SqlConnectorMetaDataExtension.java:54) ~[connector-sql-1.3-SNAPSHOT.jar!/:1.3-SNAPSHOT]
| at io.syndesis.connector.support.verifier.api.ComponentMetadataRetrieval.fetchMetaData(ComponentMetadataRetrieval.java:54) ~[connector-support-verifier-1.3-SNAPSHOT.jar!/:1.3-SNAPSHOT]
| at io.syndesis.connector.support.verifier.api.ComponentMetadataRetrieval.fetch(ComponentMetadataRetrieval.java:48) ~[connector-support-verifier-1.3-SNAPSHOT.jar!/:1.3-SNAPSHOT]
| at io.syndesis.connector.meta.v1.ConnectorEndpoint.actions(ConnectorEndpoint.java:81) ~[classes!/:1.3-SNAPSHOT]
| ... 75 common frames omitted
| Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "-"
| Position: 22
| at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
| at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
| at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
| at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
| at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
| at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:303) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
| at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:289) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
| at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:266) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
| at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:233) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
| at io.syndesis.connector.sql.common.DatabaseMetaDataHelper.getOutputColumnInfo(DatabaseMetaDataHelper.java:134) ~[connector-sql-1.3-SNAPSHOT.jar!/:1.3-SNAPSHOT]
| at io.syndesis.connector.sql.common.SqlStatementParser.parseSelect(SqlStatementParser.java:143) ~[connector-sql-1.3-SNAPSHOT.jar!/:1.3-SNAPSHOT]
| at io.syndesis.connector.sql.common.SqlStatementParser.parse(SqlStatementParser.java:87) ~[connector-sql-1.3-SNAPSHOT.jar!/:1.3-SNAPSHOT]
| at io.syndesis.connector.sql.SqlConnectorMetaDataExtension.parseStatement(SqlConnectorMetaDataExtension.java:66) ~[connector-sql-1.3-SNAPSHOT.jar!/:1.3-SNAPSHOT]
| at io.syndesis.connector.sql.SqlConnectorMetaDataExtension.meta(SqlConnectorMetaDataExtension.java:50) ~[connector-sql-1.3-SNAPSHOT.jar!/:1.3-SNAPSHOT]
| ... 78 common frames omitted
Expected behavior
Invalid query should display and inline warning and prevent proceeding with creating integration.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 23 (23 by maintainers)
Commits related to this issue
- adding error message to the exception thrown to be more specific #1936 — committed to KurtStam/syndesis by deleted user 6 years ago
@zregvart So the behavior now is the UI gets back an HTTP 200 response with an extra data attribute.
This bypasses all the error handling that’s in place where the request is made, and requires me to inspect this
_meta
attribute in the happy code path. I also now need to figure out how to suppress the toast notification, as typically when working with a form the submission error should really be displayed via an inline notification on the page which helps relate the error to the input.Why can’t the metadata API return an HTTP 400?