Closed nikolaChakarov closed 7 months ago
Hi @nikolaChakarov, I'm not sure to understand your architecture and how my node.js Pub/Sub API client comes into play in this context. Could you explain?
Hi, Philippe, thank you for answering. Once again, thank you for your efforts. I'm using the Pub/Sub API in this way. From one side I have Salesforce with a connected app. From the other side I have Google Topic. In this topic I've created a subscription which uses a Google Cloud Function. Here I import a PubSubApiClient, it's like a Node application. The runtime is Node.js 20. The issue is this one. In Google Cloud Function for the Google Pub/Sub API, if the logic written inside the
functions.cloudEvent('name', async(event) {
try {
const client = newPubSubApiClient();
await client.connect();
const payload = {
CreatedDate: new Date().getTime(),
CreatedById: userId,
name__c: 'test'
}
const publishResult = await client.publish('/event/gcloud__e', payload);
} catch(e) {
...
}
})
throws an error, this function is not acknowledged so after a certain delay of time it fires again. Here, I do not have any errors. The authentication and the connection with Salesforce work perfectly and yet, the Google Function cannot be acknowledged. Do you have any suggestions? I hope my explanation was clear. Thank you, once again!
On Thu, 4 Apr 2024 at 09:35, Philippe Ozil @.***> wrote:
Hi @nikolaChakarov https://github.com/nikolaChakarov, I'm not sure to understand your architecture and how my node.js Pub/Sub API client comes into play in this context. Could you explain?
— Reply to this email directly, view it on GitHub https://github.com/pozil/pub-sub-api-node-client/issues/30#issuecomment-2036300525, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGKKH27XLHVU2IWOVJIVJ53Y3TYCJAVCNFSM6AAAAABFPQ6PAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZWGMYDANJSGU . You are receiving this because you were mentioned.Message ID: @.***>
I don't know much about GCP behavior but I spotted some issues with your code:
new
and PubSubApiClient
.string
type enclosing in your payload for the "name" custom field (see example). You can't just have name__c: 'test'
, you have to use name__c: { string: 'test' }
. Also, be careful with the case: is it name__c
or Name__c
?Hi @nikolaChakarov, did you manage to solve your issue?
Hi Philippe, sorry for my late response. The GCP function has this feature: Retry on failure, which makes the code run again and again. That is the problem. The client works perfectly. The Google Cloud Function is still not purged after the code execution, even though there are no errors, and the communication with Salesforce is successful. I found a way to prevent the repetitive execution of the Google Cloud Function by unchecking this option, but it shouldn't be like that. Thank you again!
On Wed, 24 Apr 2024 at 19:17, Philippe Ozil @.***> wrote:
Hi @nikolaChakarov https://github.com/nikolaChakarov, did you manage to solve your issue?
— Reply to this email directly, view it on GitHub https://github.com/pozil/pub-sub-api-node-client/issues/30#issuecomment-2075345626, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGKKH27NZZVG6YA4ZCIDK7TY67LITAVCNFSM6AAAAABFPQ6PAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZVGM2DKNRSGY . You are receiving this because you were mentioned.Message ID: @.***>
Hi @pozil, thanks for all your work on this client, it's amazing! I have this issue. I'm connecting Salesforce with a Google Pub/Sub cloud topic. It's working well. The problem is that even though the Client instance is connecting and the message is sent successfully to Salesforce, the message on the Google side is not acknowledged, and it should be done automatically if publishResult is okay. Any suggestions? I really appreciate all your work and efforts. Thank you very much!