Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
4.5.0
-
None
-
None
-
Windows 10
JBang version: 0.116.0
Camel JBang version: 4.5.0
-
Unknown
Description
I am having an issue authenticating via a service account using the google-sheets-stream component.
When using a service account the scope parameter must be set and this parameter type is a collection.
I however receive the below error when the scope is set to a collection. And a separate error when it is set to a string.
based on looking through the code, I believe the issue stems from the function parseParameters in the class org.apache.camel.dsl.yaml.common.YamlDeserializerSupport. Based on my understanding of the code, it seems to assume that all parameters are scalar.
The route I'm running via jbang.
# camel-k: language=yaml # Write your routes here, for example: - from: uri: "google-sheets-stream" parameters: serviceAccountKey: "application-key.json" spreadsheetId: "sheetid" maxResults: "1" range: "Sheet1!A:B" delay: "60000" scopes: - "https://www.googleapis.com/auth/drive" steps: - log: "${body}"
Exception when the scope is set as a collection.
Node type map is invalid, expected key-value in file:cheese.yaml, line 7, column 7: serviceAccountKey: "application ... ^ at org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asScalarMap(YamlDeserializerSupport.java:220) at org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.parseParameters(YamlDeserializerSupport.java:391) at org.apache.camel.dsl.yaml.deserializers.OutputAwareFromDefinitionDeserializer.setProperties(OutputAwareFromDefinitionDeserializer.java:97) at org.apache.camel.dsl.yaml.deserializers.OutputAwareFromDefinitionDeserializer.setProperties(OutputAwareFromDefinitionDeserializer.java:34) at org.apache.camel.dsl.yaml.common.YamlDeserializerBase.construct(YamlDeserializerBase.java:67) at org.apache.camel.dsl.yaml.common.YamlDeserializationContext.lambda$resolve$1(YamlDeserializationContext.java:198) at org.apache.camel.dsl.yaml.YamlRoutesBuilderLoader$1.configure(YamlRoutesBuilderLoader.java:170) at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:780) at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:725) at org.apache.camel.builder.RouteBuilder.prepareModel(RouteBuilder.java:648) at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:666) at org.apache.camel.impl.engine.AbstractCamelContext.addRoutes(AbstractCamelContext.java:984) at org.apache.camel.main.RoutesConfigurer.addDiscoveredRoutes(RoutesConfigurer.java:254) at org.apache.camel.main.RoutesConfigurer.configureRoutes(RoutesConfigurer.java:236) at org.apache.camel.main.BaseMainSupport.configureRoutes(BaseMainSupport.java:640) at org.apache.camel.main.BaseMainSupport.postProcessCamelContext(BaseMainSupport.java:720) at org.apache.camel.main.MainSupport.initCamelContext(MainSupport.java:339) at org.apache.camel.main.KameletMain.doInit(KameletMain.java:354) at org.apache.camel.support.service.BaseService.init(BaseService.java:78) at org.apache.camel.support.service.BaseService.start(BaseService.java:105) at org.apache.camel.dsl.jbang.core.commands.Run.runKameletMain(Run.java:1125) at org.apache.camel.dsl.jbang.core.commands.Run.run(Run.java:811) at org.apache.camel.dsl.jbang.core.commands.Run.doCall(Run.java:301) at org.apache.camel.dsl.jbang.core.commands.CamelCommand.call(CamelCommand.java:71) at org.apache.camel.dsl.jbang.core.commands.CamelCommand.call(CamelCommand.java:37) at picocli.CommandLine.executeUserObject(CommandLine.java:2041) at picocli.CommandLine.access$1500(CommandLine.java:148) at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461) at picocli.CommandLine$RunLast.handle(CommandLine.java:2453) at picocli.CommandLine$RunLast.handle(CommandLine.java:2415) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273) at picocli.CommandLine$RunLast.execute(CommandLine.java:2417) at picocli.CommandLine.execute(CommandLine.java:2170) at org.apache.camel.dsl.jbang.core.commands.CamelJBangMain.run(CamelJBangMain.java:164) at org.apache.camel.dsl.jbang.core.commands.CamelJBangMain.run(CamelJBangMain.java:60) at main.CamelJBang.main(CamelJBang.java:36)
If the scope is set as a string
# camel-k: language=yaml # Write your routes here, for example: - from: uri: "google-sheets-stream" parameters: serviceAccountKey: "application-key.json" spreadsheetId: "sheetid" maxResults: "1" range: "Sheet1!A:B" delay: "60000" scopes: "https://www.googleapis.com/auth/drive" steps: - log: "${body}"
I receive the below error
Caused by: org.apache.camel.RuntimeCamelException: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: java.lang.String to the required type: java.util.Collection at org.apache.camel.RuntimeCamelException.wrapRuntimeCamelException(RuntimeCamelException.java:51) at org.apache.camel.support.component.PropertyConfigurerSupport.property(PropertyConfigurerSupport.java:97) at org.apache.camel.component.google.sheets.stream.GoogleSheetsStreamEndpointConfigurer.configure(GoogleSheetsStreamEndpointConfigurer.java:69) at org.apache.camel.support.PropertyBindingSupport.setSimplePropertyViaConfigurer(PropertyBindingSupport.java:805) ... 43 more Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: java.lang.String to the required type: java.util.Collection at org.apache.camel.impl.converter.CoreTypeConverterRegistry.mandatoryConvertTo(CoreTypeConverterRegistry.java:199) at org.apache.camel.impl.converter.CoreTypeConverterRegistry.mandatoryConvertTo(CoreTypeConverterRegistry.java:183) at org.apache.camel.support.component.PropertyConfigurerSupport.property(PropertyConfigurerSupport.java:95) ... 45 more
}}{{
Attachments
Issue Links
- links to