sst / ion

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

orderedCacheBehaviors transformation not resolved #560

Open creaux opened 2 weeks ago

creaux commented 2 weeks ago

I'm trying to update orderedCacheBehaviors while keeping existing one.

However following solution never leads to expected result. I have tried to use .apply instead, and as well go deeper to cdn -> transform -> distribution callback and tried update args there but still not success.

    const router = new sst.aws.Router("Router", {
      domain: {
        name: domain,
      },
      routes: {
        "/*": astro.url,
      },
      transform: {
        cdn(cdnArgs) {
          $concat(cdnArgs.orderedCacheBehaviors, {
            pathPattern: "/api/*",
            targetOriginId: "/*",
            compress: true,
            viewerProtocolPolicy: "redirect-to-https",
            allowedMethods: [
              "GET",
              "HEAD",
              "OPTIONS",
              "PUT",
              "PATCH",
              "POST",
              "DELETE",
            ],
            cachedMethods: ["HEAD", "GET", "OPTIONS"],
            cachePolicyId: "xyz,
            originRequestPolicyId: "abc",
          });
        },
      },
    });
ryanleecode commented 2 weeks ago

Whats the error? I have it working

jayair commented 6 days ago

Ping @creaux