Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(amplify-alpha): migrate asset deployment handler #27955

Merged
merged 3 commits into from
Nov 14, 2023

Conversation

colifran
Copy link
Contributor

This PR moves the migrate asset deployment handler to our new centralized location for custom resource handlers in the @aws-cdk package.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
@github-actions github-actions bot added the p2 label Nov 13, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team November 13, 2023 04:17
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Nov 13, 2023
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Nov 13, 2023
Copy link
Contributor

mergify bot commented Nov 13, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Nov 13, 2023
Copy link
Contributor

mergify bot commented Nov 13, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 3559dae
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 331369f into main Nov 14, 2023
9 checks passed
@mergify mergify bot deleted the colifran/migrate-asset-deployment-handler branch November 14, 2023 00:23
Copy link
Contributor

mergify bot commented Nov 14, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

mergify bot pushed a commit that referenced this pull request Jan 16, 2024
…28658)

Error:

```bash
Error: Cannot find entry file at /node_modules/@aws-cdk/custom-resource-handlers/dist/
aws-amplify-alpha/asset-deployment-handler/index.js
```

In #27955, we migrated the aws-amplify-alpha custom resource to `@aws-cdk/custom-resource-handlers`, our internal package for storing all custom resources. However, this migration was half-baked. The reason is because we seem to have depended on our `@aws-cdk/custom-resource-handlers` package directly. That works locally, as we have `custom-resource-handlers` readily available. 

```
|-- @aws-cdk
    |-- aws-amplify-alpha
    |-- custom-resource-handlers
```

`aws-amplify-alpha` directly went into `custom-resource-handlers` to grab the necessary entry file. This works locally, because we have access to all folders with impunity.

Of course, when packaged and published, we publish only `aws-amplify-alpha` with no other outside folders:

```
|-- @aws-cdk 
    |-- aws-amplify-alpha
```

Thus, the published module would not have access to the file under `custom-resource-handlers`, and predictably fails at synth time. 

In `aws-cdk-lib`, we airlift the necessary files _into_ the package and release it alongside `aws-cdk-lib`:

```
|-- aws-cdk-lib
    |-- aws-synthetics
    |-- custom-resource-handlers/dist/aws-synthetics/custom-resource-handler // this was airlifted into aws-cdk-lib
```

We are supposed to do the same airlift mechanism for `aws-amplify-alpha` but somehow that was forgotten. This PR adds in the necessary structure, so now `aws-amplify-alpha` looks like this:

```
|-- @aws-cdk 
    |-- aws-amplify-alpha
        |-- custom-resource-handlers/dist/aws-amplify-alpha // airlifted in via this PR
    |-- custom-resource-handlers/dist
        |-- aws-amplify-alpha
```

(please excuse my horrible ascii notation)

Fixes #28633. Fixes #28089. I tested my locally packaged `aws-amplify-alpha` on a local CDK app to confirm that the necessary structure exists in the packaged module.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. handler-migration p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants