sst / ion

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

sst deploy: error when setting cloudflare dns #264

Closed markhker closed 3 months ago

markhker commented 3 months ago

sst ion version: 0.0.296

When setting a dns domain with sst.cloudflare.dns got the following error:

Failed
   In "Gateway" component, the physical name of "GatewayCNAMERecordApiexamplecom" (cloudflare:index/record:Record) is not prefixed
   In "HousDashboardCdn" component, the physical name of "HousDashboardCdnCNAMERecordExamplecom" (cloudflare:index/record:Record) is not prefixed
   In "HousWebsiteCdn" component, the physical name of "HousWebsiteCdnCNAMERecordExamplecom" (cloudflare:index/record:Record) is not prefixed

I believe the case should be added to the file https://github.com/sst/ion/blob/dev/pkg/platform/src/components/component.ts but I am not sure.

RyanTheAllmighty commented 3 months ago

I am also getting this.

new sst.aws.Nextjs('App', {
    domain: {
        name: 'somedomain.com',
        dns: sst.cloudflare.dns(),
    },
});

Adding the below to .sst/platform/src/components/component.ts locally fixes the issue and allows me to deploy.

https://github.com/sst/ion/blob/dev/pkg/platform/src/components/component.ts#L151

            case "aws:sns/topicSubscription:TopicSubscription":
            case "cloudflare:index/workerDomain:WorkerDomain":
+           case "cloudflare:index/record:Record":
            case "vercel:index/dnsRecord:DnsRecord":
              break;

Literally only started using SST in the last couple hours, so not entirely sure if this is the correct solution to put a PR in, but would be good to see it fixed.

dev2xl commented 3 months ago

I am also getting this error

Error In "MyWebCdnSsl" component, the physical name of "MyWebCdnSslCNAMERecordC2391facce1ed0d577a6fc4167d97451mydomainus" (cloudflare:index/record:Record) is not prefixed

async run() {
    new sst.aws.Nextjs("MyWeb", {
      domain: {
        name: 'mydomain.us',
        dns: sst.cloudflare.dns({
          zone: "415e4rv6f2353b6d44b775d350f34379cdb"
        })
      }
    });
  },
markhker commented 3 months ago

Fixed in v0.0.311