Webhook Common Issues and FAQ
Here are some common issues and solutions for them.
Â
- 1 Errors
findProjectsForChange/findPackagesForChange functions are not finding my projects
The most common reason your projects/packages are not being found is because there is no webhook trigger on the project configured for this stream.
Ensure the repository name configured in your integration instance in FlexDeploy matches the repository name received from the webhook (case insensitive).
If a sparse checkout folder is configured on your project, your project will only be detected for a change if one of the modified files from the push event is contained in the sparse checkout folder.
For example - If you received a push event for a changed file '/content/project1/dist/index.html'. A project with sparse checkout 'content/project2' would not be returned whereas a project with sparse checkout 'content/project1' would be.
How do I create a new Release Snapshot from a webhook build?
The simplest way is to simply configure a Snapshot Schedule on your release. When the schedule runs it will find the newly built project version which resulted from the webhook.
A 'createSnapshot' function also exists which can be used within a webhook function. Â
No webhooks are being received by FlexDeploy (webhook messages screen is blank)
The webhooks may not be getting through because of the firewall. See Webhook Security for options on allowing webhooks to be received by FlexDeploy without sacrificing security.
Should I manage webhooks per repository, or globally for my SCM?
Webhooks in FlexDeploy have the capability for both options. Most SCMs have separate configuration of webhooks per repository. If you don't need separate customizations per repository, it's recommended to create one provider and one or a couple functions in FlexDeploy for your SCM for easier management. However, if your use case is different depending on the repository, you can configure multiple providers for your SCM to group repositories, or group them by URIs associated with different functions, and manage them separately in that way.
What if I don't see a function that I need?
If there is a function that you don't see available that would be needed to fit your use case you can first check the release notes of later FlexDeploy versions to see if the function you need has since been added. If you still don't see your function you can open an enhancement request on the support site.Â
What if I have multiple FlexDeploy Projects using a single Git Repository?
This is the exact intent the FLEXDEPLOY.findProjectsForChange method was created. The method will find all projects using the passed repository name, and validate the files that changed are included as a part of the FlexDeploy Project Sources.
Use this function in tandem with getChangeLogs methods on BITBUCKET and GITHUB.
My HMAC string is not matching
The most common reason for your HMAC string not generating correctly is by using the PAYLOAD variable instead of the FLX_PRISTINE_PAYLOAD variable. PAYLOAD has been formatted and converted by FlexDeploy to allow easier manipulation whereas FLX_PRISTINE_PAYLOAD is the payload exactly as it was received. FLX_PRISTINE_PAYLOAD should be the payload used when generating HMAC strings. Some other reasons why it may not be matching are:
Incorrect algorithm used (check your providers documentation to verify what algorithm they encrypt with).
The Provider is encrypting more than just the payload. For example, Slack encrypts the payload, timestamp and other fields into the HMAC string.
What is the purpose of the LOG.setMessage function?
Often times your Webhook Function may result in any number of different outcomes. Rather than having to go into a request and look at the logs you can use the setMessage function to set the 'message' column on the message table. Below is an example where using the setMessage function can be helpful:
The function running for Bitbucket on bitbucket/push receives all push events on all branches. We only care about pushes to certain branches so when we receive an insignificant push event we can set the message accordingly.
Errors
If you use LOG.setMessage in your function and the function later errors, the error message will take priority and override your message from the setMessage function.
- style