sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
1.09k stars 126 forks source link

Astro deployment delete/remove fail (CloudFront "resource in use" errors) #443

Open hexrw opened 1 month ago

hexrw commented 1 month ago

Unable to delete Astro website deployed with SST even after multiple attempts.

Project Setup

├── infra
│   ├── config.ts
│   ├── cron.ts
│   ├── email.ts
│   ├── functions.ts
│   ├── index.ts
│   ├── notifications.ts
│   ├── secrets.ts
│   ├── sites.ts
│   └── storage.ts
├── package.json
├── packages
│   ├── core
│   ├── functions
│   └── website
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
├── sst-env.d.ts
├── sst.config.ts
└── tsconfig.json

Environment

SST CLI output

| Error Website sst:aws:Astro → WebsiteServerCachePolicy aws:cloudfront:CachePolicy CloudFront: DeleteCachePolicy, https response error StatusCode: 409, RequestID: c5460bf5-755b-44bb-8e20-353f02cef48d, CachePolicyInUse: The specified cache policy is currently associated with a cache behavior. Please disassociate the policy before deleting.
| Error Website sst:aws:Astro → WebsiteCloudfrontFunctionServerCfFunction aws:cloudfront:Function CloudFront: DeleteFunction, https response error StatusCode: 409, RequestID: a59d6594-2403-452d-aa15-522a76f80bc8, FunctionInUse: Cannot delete function WebsiteCloudfrontFunctionServerCfFunction-c076cb6, it is in use by 1 distributions
| Error Website sst:aws:Astro → WebsiteCloudfrontFunctionImageServiceCfFunction aws:cloudfront:Function CloudFront: DeleteFunction, https response error StatusCode: 409, RequestID: c237c36f-abcd-1234-9314-8202c553aa67, FunctionInUse: Cannot delete function WebsiteCloudfrontFunctionImageServiceCfFunction-62c0fb2, it is in use by 1 distributions
CloudFrontOriginAccessIdentityInUse: The CloudFront origin access identity is still being used.: CloudFrontOriginAccessIdentityInUse: The CloudFront origin access identity is still being used.
    at de_CloudFrontOriginAccessIdentityInUseRes (/Users/x/Work/y/z/.sst/platform/node_modules/@aws-sdk/client-cloudfront/dist-cjs/protocols/Aws_restXml.js:7254:23)
    at de_DeleteCloudFrontOriginAccessIdentityCommandError (/Users/x/Work/y/z/.sst/platform/node_modules/@aws-sdk/client-cloudfront/dist-cjs/protocols/Aws_restXml.js:3308:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/x/Work/y/z/.sst/platform/node_modules/@smithy/middleware-serde/dist-cjs/index.js:35:20
    at async /Users/x/Work/y/z/.sst/platform/node_modules/@aws-sdk/client-cloudfront/node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthMiddleware.js:30:20
    at async __f4. (:161:46)
    at async /Users/x/Work/y/z/.sst/platform/node_modules/@aws-sdk/client-cloudfront/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:7:26
    at async __f1. (:657:9)
| Error Website sst:aws:Astro → WebsiteOriginAccessIdentity sst:aws:OriginAccessIdentity The CloudFront origin access identity is still being used.

× Failed
   WebsiteCdnSsl sst:aws:Certificate → WebsiteCdnSslCertificate aws:acm:Certificate
   ACM: DeleteCertificate, https response error StatusCode: 400, RequestID: 6706097f-d43c-abcd-bfae-45327879a926, ResourceInUseException: Certificate arn:aws:acm:us-east-1:XXXXXXXXXXXX:certificate/3aef96bd-1234-4321-abcd-d470cc8ec629 in account XXXXXXXXXXXX is in use.
   Website sst:aws:Astro → WebsiteServerCachePolicy aws:cloudfront:CachePolicy
   CloudFront: DeleteCachePolicy, https response error StatusCode: 409, RequestID: c5460bf5-755b-44bb-8e20-353f02cef48d, CachePolicyInUse: The specified cache policy is currently associated with a cache behavior. Please disassociate the policy before deleting.
   Website sst:aws:Astro → WebsiteCloudfrontFunctionServerCfFunction aws:cloudfront:Function
   CloudFront: DeleteFunction, https response error StatusCode: 409, RequestID: abcd1234-2403-452d-aa15-522a76f80bc8, FunctionInUse: Cannot delete function WebsiteCloudfrontFunctionServerCfFunction-c046cb6, it is in use by 1 distributions
   Website sst:aws:Astro → WebsiteCloudfrontFunctionImageServiceCfFunction aws:cloudfront:Function
   CloudFront: DeleteFunction, https response error StatusCode: 409, RequestID: c237c36f-7eb1-47f1-9314-8202c553aa67, FunctionInUse: Cannot delete function WebsiteCloudfrontFunctionImageServiceCfFunction-62c0fb2, it is in use by 1 distributions
   Website sst:aws:Astro → WebsiteOriginAccessIdentity sst:aws:OriginAccessIdentity
   The CloudFront origin access identity is still being used.

   ELIFECYCLE  Command failed with exit code 1.
 ```