question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SQL query validation fails with unable to fetch metadata

See original GitHub issue

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.

Cc @KurtStam @zregvart any ideas?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:23 (23 by maintainers)

github_iconTop GitHub Comments

1reaction
gashcrumbcommented, Mar 13, 2018

@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?

0reactions
zregvartcommented, Mar 14, 2018

In retrospect I probably should have argued against that PR more 😃 I’ll still have to change the UI to look at _meta as it’s expecting an error object back currently.

Don’t we have that already in:

https://github.com/syndesisio/syndesis/blob/7f3c0185f9e67456dc80dedf642dbb3f95dde8d1/app/ui/src/app/api/providers/api-http-interceptor.service.ts#L8

We can revert changes, no shame in that 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to validate source query in Tabular Editor
Suppose you are making some changes to the underlying source of the table and you hit “refresh table metadata” to add some new...
Read more >
Validation failed for one or more entities while saving changes ...
Save this question. Show activity on this post. I want to save my Edit to Database and I am using Entity FrameWork Code-First...
Read more >
Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >
Unable to validate custom query when using a stored ... - Search
When using a source transformation with a SQL Server connector, trying to validate a stored procedure that references a temp table throws ...
Read more >
Common Issues with the SQL Server Import and Export Wizard
Error 0xc0202045 : Data Flow Task 1: Column metadata validation failed. ... If you try it then you will probably get an error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found