amplify-hosting
amplify-hosting copied to clipboard
Feature request: Use custom domain in PR comment for preview link
Is your feature request related to a problem? Please describe. When a PR is created, the AWS Amplify GitHub bot comments the preview URL, as added in #264. This is great, except that we are using a custom domain.
So the comment mentions https://pr-{PR}.{APP_ID}.amplifyapp.com
, while it should be https://pr-{PR}.example.com
.
This is important for us because our app does not work on the amplifyapp.com domain due to CORS restrictions, so we must use our custom domain.
Describe the solution you'd like Please allow configuring the PR bot to use a custom domain.
Hi Duncan! 👋🏽 Thanks for raising this feature request. Currently, the Web Previews feature is only available for Amplify apps connected to custom domains managed by Amazon Route 53. We will review this feature request further with the team. 🙂
Hi @hloriana in our app we use Route 53 for costom domains, but this comment shows same amplifyapp.com domain as on @d-luk screenshot
Same issue here, everything works fine with our custom domain, except Amplify now adds bogus comment in all our PRs revealing the amplifyapp.com subdomains that were supposed to be hidden, and are not functioning in our use cases.
TL;DR this creates a huge mess
The same here!
We create two environments with amplify and we can't identify who is on PR comment.
I'm experiencing the same issue. I have a custom domain set up in Route 53 and subdomain auto-detection is enabled and working for PRs. However, the Github App still uses the amplifyapp.com
domain in the PR comment.
Any news maybe this issue is being investigated?
I'd love not to write a robot that deletes the Amplify comments.
Any other news or updates? Or does anyone have a workaround that drags in the correct link each time?
Hi Duncan! 👋🏽 Thanks for raising this feature request. Currently, the Web Previews feature is only available for Amplify apps connected to custom domains managed by Amazon Route 53. We will review this feature request further with the team. 🙂
Hi @hloriana , have you discussed this feature with the team? We also would love to use such a feature to avoid CORS restrictions.
Same issue here. We were able to create previews under the custom domain (and the Preview URL in the AWS Console actually shows the right domain), but the comment is still sent with the amplify domain. This would be quite important for us to resolve, as it creates unnecessary friction and confusion with the dev team.
@santiagoaguiar how do you guys set it up to use custom domain for previews? I connected our domain successfully, but pr previews are still created on *.amplifyapp.com which yeah due to CORS issues are not what we want at all.
@sorokinvj if you have a domain registered in route 53 you can connect it in the domain management page from the amplify page on the AWS site. Then on gh I just wrote a bot that would post the correct link based on the branch name since our branches + prs are named predictably
@sorokinvj we had to enable branch deployments for all the PRs (this was unexpected, I would have expected just enabling previews would be enough).
That being said, we dropped this as we run into other issues:
- (this issue) The comment was confusing for users, we attempted to hack it through GitHub actions to edit the message but amplify keep posting new ones. We opted to minimize Amplify comment and add ours which did the trick but was quite ugly.
- Most of our PRs are created from branches with
/
in the name. For some reason, custom domains where not created for those PRs, which made the feature unusable for us. We did most of the setup on a branch without a/
on it so we caught this a bit later in the process...
Honestly, this was something we expected to be simple and ended up spending more time that we wanted on it. We might do another pass at this later, or just move to something else.
Any update on this issue? We are experiencing the same problem
Any updates on this issues? I was able to connect the PR Previews to my custom domain but in Github the bot added a message that is displaying the amplify domain.
+1 I would also prefer to have the domain name in the bot comment either configurable or default to using a custom domain if there is a custom domain present.
+1 as well, we have a use case where domains are allow listed for CORS headers and the comments are basically useless and confusing
We ended up using a GitHub action to try to fix the issue.
on:
issue_comment:
types: [created]
jobs:
pr_commented:
name: PR comment
if: ${{ github.event.issue.pull_request && contains(github.event.comment.user.login, 'aws-amplify-us-east-1[bot]') }}
runs-on: ubuntu-latest
steps:
- run: |
echo trying to edit comment on PR $NUMBER $USER_ID $COMMENT_ID
env:
USER_ID: ${{ github.event.comment.user.login }}
COMMENT_ID: ${{ github.event.comment.id }}
NUMBER: ${{ github.event.issue.number }}
- name: Update comment
uses: peter-evans/create-or-update-comment@v3
with:
edit-mode: replace
comment-id: ${{github.event.comment.id}}
body: |
This pull request is automatically being deployed by Amplify Hosting ([learn more](https://aws.amazon.com/amplify/hosting/)).<br/><br/>Access this pull request here: https://pr-${{github.event.issue.number}}.example.com
We don't seem to be able to configure custom domain for PR Previews yet, anyone has a guide for it? We followed this guide and no luck.
Also, perhaps removing Amplify App from GitHub and connecting it again may do the trick for those having the old non-custom domain posted in PRs.