Question

Strapi Webhook for Redeploying Frontend

I’m trying to get strapi to trigger a re-deploy of my app using DigitalOcean’s API.

Specifically I’m using the https://api.digitalocean.com/v2/apps/{app-id}/deployments POST endpoint but although I can authenticate correctly the request is rejected for some reason. It appears Strapi is sending a body along with the request which DigitalOcean rejects. Below is the error message I receive back from DigitalOcean.

{ statusCode: 400, message: "{\"id\":\"invalid_argument\",\"message\":\"unknown field \\\"event\\\" in apps.CreateDeploymentRequest\"}\n" }

Has anyone managed to get this working?

Show comments

Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Having the exact same issue with another CMS (Hygraph) and webhooks.

It seems that when a webhook is triggered by an external source (CMS, Zapier, other server etc) the apps.CreateDeploymentRequest fails because the external source will usually pass along some other data i.e Hygraph passes the following…

{
  "operation": "publish",
  "data": {
    "__typename": "Page",
    "id": "clblk3v8909xv0b2o3s95k8l4",
    "stage": "PUBLISHED"
  }
}

and i receive the following reply from digital oceans API

"{\"id\":\"invalid_argument\",\"message\":\"unknown field \\\"operation\\\" in apps.CreateDeploymentRequest\"}\n"

This seems like a fairly serious issue with Digital Ocean webhooks

Bobby Iliev
Site Moderator
Site Moderator badge
February 11, 2022

Hello,

Does this work if you try to run the following POST request using curl directly:

curl \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer TOKEN" \
    "https://api.digitalocean.com/v2/apps/<app_id>/deployments" \
    -XPOST \
    -d '{"force_build": true}

Best,

Bobby