Report this

What is the reason for this report?

Strapi Webhook for Redeploying Frontend

Posted on February 7, 2022

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?



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!

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.

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

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.