You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/04/11 12:01:05 UTC

[GitHub] [camel-k] akieling opened a new issue #1403: Failed to read a GraphQL query from a ConfigMap

akieling opened a new issue #1403: Failed to read a GraphQL query from a ConfigMap
URL: https://github.com/apache/camel-k/issues/1403
 
 
   GraphQL queries with the query specified in the URI work fine but queries stored in ConfigMaps don't seem to work. An exception is thrown when trying to read the query text.
   
   Command:
   ```
   kamel run --configmap=hello-config hello.groovy --dev
   ```
   
   hello.groovy
   ```
   from('timer:tick?period=10s')
       .to("graphql://https://countries.trevorblades.com/?query={{query.continents}}")
       .to('log:info')
   ```
   
   hello-config.yaml
   ```
   apiVersion: v1
   kind: ConfigMap
   metadata:
     name: hello-config
   data:
     application.properties: |
       query.continents={continents{code name}}
   ```
   
   Error:
   ```
   [1] Exception in thread "main" org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[graphql://https://countries.trevorblades.com/?query={{query.continents}}] <<< in route: Route(route1)[From[timer:tick?period=10s] -> [To[graphql://h... because of Missing {{ from the text: {continents{code name}}
   [1] 	at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:386)
   [1] 	at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:108)
   [1] 	at org.apache.camel.impl.DefaultModel.start(DefaultModel.java:356)
   [1] 	at org.apache.camel.impl.DefaultModel.startRoute(DefaultModel.java:330)
   [1] 	at org.apache.camel.impl.DefaultModel.startRouteDefinitions(DefaultModel.java:323)
   [1] 	at org.apache.camel.impl.DefaultModel.startRouteDefinitions(DefaultModel.java:302)
   [1] 	at org.apache.camel.impl.AbstractModelCamelContext.startRouteDefinitions(AbstractModelCamelContext.java:342)
   [1] 	at org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:2595)
   [1] 	at org.apache.camel.impl.engine.AbstractCamelContext.lambda$doStart$2(AbstractCamelContext.java:2443)
   [1] 	at org.apache.camel.impl.engine.AbstractCamelContext.doWithDefinedClassLoader(AbstractCamelContext.java:2460)
   [1] 	at org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2441)
   [1] 	at org.apache.camel.support.service.ServiceSupport.start(ServiceSupport.java:117)
   [1] 	at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2350)
   [1] 	at org.apache.camel.k.main.ApplicationRuntime$MainAdapter.doStart(ApplicationRuntime.java:189)
   [1] 	at org.apache.camel.support.service.ServiceSupport.start(ServiceSupport.java:117)
   [1] 	at org.apache.camel.main.MainSupport.run(MainSupport.java:77)
   [1] 	at org.apache.camel.k.main.ApplicationRuntime.run(ApplicationRuntime.java:76)
   [1] 	at org.apache.camel.k.main.Application.main(Application.java:42)
   [1] Caused by: java.lang.IllegalArgumentException: Missing {{ from the text: {continents{code name}}
   [1] 	at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.readProperty(DefaultPropertiesParser.java:139)
   [1] 	at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.doParse(DefaultPropertiesParser.java:102)
   [1] 	at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.doParse(DefaultPropertiesParser.java:113)
   [1] 	at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.parse(DefaultPropertiesParser.java:86)
   [1] 	at org.apache.camel.component.properties.DefaultPropertiesParser.parseUri(DefaultPropertiesParser.java:59)
   [1] 	at org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:262)
   [1] 	at org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:166)
   [1] 	at org.apache.camel.impl.engine.AbstractCamelContext.resolvePropertyPlaceholders(AbstractCamelContext.java:1661)
   [1] 	at org.apache.camel.model.ProcessorDefinitionHelper.resolvePropertyPlaceholders(ProcessorDefinitionHelper.java:806)
   [1] 	at org.apache.camel.reifier.ProcessorReifier.makeProcessorImpl(ProcessorReifier.java:551)
   [1] 	at org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:537)
   [1] 	at org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:250)
   [1] 	at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:384)
   [1] 	... 17 more
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-k] nicolaferraro edited a comment on issue #1403: Failed to read a GraphQL query from a ConfigMap

Posted by GitBox <gi...@apache.org>.
nicolaferraro edited a comment on issue #1403: Failed to read a GraphQL query from a ConfigMap
URL: https://github.com/apache/camel-k/issues/1403#issuecomment-612596830
 
 
   ~~Hi, the `--configmap` or `--secret` options are for passing a xxx.properties file for the standard camel configuration.
   
   Probably what you need to use is the `--resource` flag, passing directly the file you want to use as resource.~~
   
   My bad, didn't read it fully ;)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-k] nicolaferraro commented on issue #1403: Failed to read a GraphQL query from a ConfigMap

Posted by GitBox <gi...@apache.org>.
nicolaferraro commented on issue #1403: Failed to read a GraphQL query from a ConfigMap
URL: https://github.com/apache/camel-k/issues/1403#issuecomment-612597175
 
 
   I guess there's something wrong in the parser or we need some escaping. The `}}` in the query makes the parser to require a `{{`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-k] lburgazzoli commented on issue #1403: Failed to read a GraphQL query from a ConfigMap

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1403: Failed to read a GraphQL query from a ConfigMap
URL: https://github.com/apache/camel-k/issues/1403#issuecomment-613272835
 
 
   @akieling yes please

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-k] akieling commented on issue #1403: Failed to read a GraphQL query from a ConfigMap

Posted by GitBox <gi...@apache.org>.
akieling commented on issue #1403: Failed to read a GraphQL query from a ConfigMap
URL: https://github.com/apache/camel-k/issues/1403#issuecomment-612868338
 
 
   @nicolaferraro The issue seems to be in the Camel code, not in the Camel K code. Shall I close this issue?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-k] nicolaferraro removed a comment on issue #1403: Failed to read a GraphQL query from a ConfigMap

Posted by GitBox <gi...@apache.org>.
nicolaferraro removed a comment on issue #1403: Failed to read a GraphQL query from a ConfigMap
URL: https://github.com/apache/camel-k/issues/1403#issuecomment-612596830
 
 
   ~~Hi, the `--configmap` or `--secret` options are for passing a xxx.properties file for the standard camel configuration.
   
   Probably what you need to use is the `--resource` flag, passing directly the file you want to use as resource.~~
   
   My bad, didn't read it fully ;)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-k] akieling commented on issue #1403: Failed to read a GraphQL query from a ConfigMap

Posted by GitBox <gi...@apache.org>.
akieling commented on issue #1403: Failed to read a GraphQL query from a ConfigMap
URL: https://github.com/apache/camel-k/issues/1403#issuecomment-612863354
 
 
   Yep, there seems to be an issue with the parser when the property values contain double curly braces. About my example, thanks for letting me know that I should be using the `--resource` flag to expose the GraphQL query file to the app. It's working fine the following way:
   
   Command
   ```
   kamel run hello.groovy --resource hello.graphql
   ```
   
   hello.groovy
   ```
   from('timer:tick?period=10s')
       .to("graphql://https://countries.trevorblades.com/?queryFile=hello.graphql")
       .to('log:info')
   ```
   
   hello.graphql
   ```
   query Continents {
     continents {
       code
       name
     }
   }
   ```
   
   Output
   ```
   ...
   2020-04-13 11:31:11.324 INFO  [Camel (camel-k) thread #1 - timer://tick] info - Exchange[ExchangePattern: InOnly, BodyType: String, Body: {"data":{"continents":[{"code":"AF","name":"Africa"},{"code":"AN","name":"Antarctica"},{"code":"AS","name":"Asia"},{"code":"EU","name":"Europe"},{"code":"NA","name":"North America"},{"code":"OC","name":"Oceania"},{"code":"SA","name":"South America"}]}}]
   ...
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-k] nicolaferraro commented on issue #1403: Failed to read a GraphQL query from a ConfigMap

Posted by GitBox <gi...@apache.org>.
nicolaferraro commented on issue #1403: Failed to read a GraphQL query from a ConfigMap
URL: https://github.com/apache/camel-k/issues/1403#issuecomment-612596830
 
 
   Hi, the `--configmap` or `--secret` options are for passing a xxx.properties file for the standard camel configuration.
   
   Probably what you need to use is the `--resource` flag, passing directly the file you want to use as resource.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-k] akieling closed issue #1403: Failed to read a GraphQL query from a ConfigMap

Posted by GitBox <gi...@apache.org>.
akieling closed issue #1403: Failed to read a GraphQL query from a ConfigMap
URL: https://github.com/apache/camel-k/issues/1403
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services