Nicolas Filotto created CAMEL-19161:
---------------------------------------

             Summary: camel-salesforce - Connection issue when using lazy login
                 Key: CAMEL-19161
                 URL: https://issues.apache.org/jira/browse/CAMEL-19161
             Project: Camel
          Issue Type: Bug
          Components: camel-salesforce
    Affects Versions: 3.11.1
            Reporter: Nicolas Filotto


When we enable lazy login, we end up with an exception of type:

{noformat}
2023-03-16 16:49:40,743 [main           ] WARN  SalesforceComponent            
- Missing property packages, getSObject* operations will NOT work without 
property rawPayload=true
2023-03-16 16:49:53,432 [main           ] INFO  SalesforceSession              
- Login at Salesforce loginUrl: 
https://login.salesforce.com/services/oauth2/token
2023-03-16 16:50:28,009 [main           ] INFO  SalesforceSession              
- Login successful
2023-03-16 16:50:33,456 [forceHttpClient] WARN  SubscriptionHelper             
- Handshake failure: {failure={exception=java.lang.IllegalArgumentException: 
Invalid protocol null, message={ext={replay=true}, 
supportedConnectionTypes=[long-polling], channel=/meta/handshake, id=1, 
version=1.0}, connectionType=long-polling}, channel=/meta/handshake, id=1, 
successful=false}
2023-03-16 16:50:33,457 [forceHttpClient] INFO  SubscriptionHelper             
- Handshaking after unexpected disconnect from Salesforce...
2023-03-16 16:50:57,019 [forceHttpClient] WARN  SubscriptionHelper             
- Handshake failure: {failure={exception=java.lang.IllegalArgumentException: 
Invalid protocol null, message={ext={replay=true}, 
supportedConnectionTypes=[long-polling], channel=/meta/handshake, id=2, 
version=1.0}, connectionType=long-polling}, channel=/meta/handshake, id=2, 
successful=false}
2023-03-16 16:51:00,769 [forceHttpClient] WARN  SubscriptionHelper             
- Handshake failure: {failure={exception=java.lang.IllegalArgumentException: 
Invalid protocol null, message={ext={replay=true}, 
supportedConnectionTypes=[long-polling], channel=/meta/handshake, id=3, 
version=1.0}, connectionType=long-polling}, channel=/meta/handshake, id=3, 
successful=false}
{noformat}


After a deeper investigation, it is due to the fact that when [creating the 
{{BayeuxClient}} during 
startup|https://github.com/apache/camel/blob/main/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java#L405],
 it calls {{component.getSession().getInstanceUrl()}} to build the Url used by 
the client to connect but the instance Url is null as long as it not connected. 






--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to