decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

Deploy Preview Links Not Working With AWS Amplify Preview Builds

Open BenedictWHD opened this issue 4 years ago • 9 comments
trafficstars

Describe the bug Preview link to the the AWS created URL sent to the github check is not displayed in the Editor.

To Reproduce

  1. Setup NetlifyCMS to work with AWS Amplify.
  2. Enable AWS Amplify Preview builds, that trigger when a PR is created for your branch (When you make a change in the NetlifyCMS editor)
  3. Can see the new provided URL in the Github check.
  4. View Preview button does not display on the Editor and so cannot preview the changes before publishing the changes.

Expected behavior I would expect for the preview button to display in the editor and to be able to click it to be taken to the URL of the unpublished changes.

Screenshots NetlifyCMS

Applicable Versions:

  • netlify-cms-app 2.14.19
  • netlify-cms-core 2.37.1
  • Git provider: GitHub
  • OS: Windows 10
  • Chrome

CMS configuration

  "backend": {
    "name": "github",
    "repo": "R/P",
    "branch": "master",
    "site_domain": "https://X1.com",
    "base_url": "https://X2.com",
    "auth_endpoint": "/prod/auth"
  },
  "load_config_file": false,
  "site_url": "https://X3.com",
  "display_url": "https://X3.com",
  "media_folder": "/public/img",
  "public_folder": "img",
  "publish_mode": "editorial_workflow",

BenedictWHD avatar Mar 25 '21 13:03 BenedictWHD

Believe the issue is that NetlifyCMS searches for status on PRs and Amplify Previews add the URL of the preview in checks

BenedictWHD avatar Mar 26 '21 11:03 BenedictWHD

  1. Setup NetlifyCMS to work with AWS Amplify.

I'm not sure how to follow this. Can you share a repo?

Believe the issue is that NetlifyCMS searches for status on PRs and Amplify Previews add the URL of the preview in checks

The CMS looks for the commit status of the PR https://github.com/netlify/netlify-cms/blob/9662331c517d02d3d79540ff019a0f39e3f202ce/packages/netlify-cms-backend-github/src/API.ts#L857

If you share how to extract the URL from "checks" it would make it easier to implement

erezrokah avatar Mar 29 '21 09:03 erezrokah

Here response from /commits/${sha}/status for my PR commit: { "state": "pending", "statuses": [], "sha": "{sha}", "total_count": 0,

statuses array is empty and NetlifyCMS can't find preview Url.

Here response from /commits/${sha}/check-runs for my PR commit: { "total_count": 1, "check_runs": [ { "id": 3701733993, "details_url": "https://pr-1.{app}.amplifyapp.com", "name": "AWS Amplify Console Web Preview",

AWS Amplify (us-east-1) app permissions:

  • Read access to code and metadata
  • Read and write access to checks, pull requests, and repository hooks

I think that AWS Amplify (us-east-1) app adds only checks and NetlifyCMS checks only statuses.

Check run has details_url: check-run--parameters There are checks and statuses: types-of-status-checks-on-github

Either NetlifyCMS should check "check-runs" of a specific commit or AWS Amplify (us-east-1) app should add status with a context containing "deploy" keyword to fix this issue.

Probably NetlifyCMS can search by check's name additionally to searching by status context. Maybe rename "preview_context" to "preview_status_context" and add a new one "preview_check_name".

mikhailovenator avatar Sep 24 '21 16:09 mikhailovenator

FYI we have a PR to support deployments that can be used as a reference for status checks support (if we decide to support them).

erezrokah avatar Sep 29 '21 16:09 erezrokah

@erezrokah On that PR you reference, you state that you would like comments if this would be liked to be re-opened. I would very much appreciate if it could be added to netlifyCMS to allow previewlinks to resolve against check status - specifically due to amplifyAWS. It would be much appreciated.

RogerBlasco avatar Apr 22 '22 22:04 RogerBlasco

hello. who can help me to update my netlifycms version

chamara8901 avatar Dec 22 '22 11:12 chamara8901

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 26 '23 09:04 stale[bot]

Still an issue. I'm using Cloudflare Pages for deployment, and preview links don't work with it (since it uses checks instead of statuses).

6ixfalls avatar Jun 04 '23 23:06 6ixfalls