sst / ion

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

Astro SST is broken #532

Closed ironbyte closed 3 weeks ago

ironbyte commented 3 weeks ago

I keep getting this useless error message when trying to deploy my Astro app to AWS

Error: Could not find build meta file at dist/sst.buildMeta.json. Update your 'astro-sst' package version and rebuild your Astro site.

Don't know if it is just me but I think this might be reproducible across machines.

Repo steps:

  1. pnpm create astro (then change directory into the newly Astro directory)
  2. Run sst init and double check that your SST config's all good. Make sure it's set up for AWS.
  3. Run sst deploy

Expected:

My site should be deployed to AWS and that a generated Cloudfront URL should actually be working without fail. No random issues. More importantly, it should not return null. At the end of day, it should just work. Please.

/// <reference path="./.sst/platform/config.d.ts" />

export default $config({
  app(input) {
    return {
      name: "dark-debris",
      removal: input?.stage === "production" ? "retain" : "remove",
      home: "aws",
      providers: {
        aws: {
          profile: "dev",
        },
      },
    };
  },
  async run() {
    new sst.aws.Astro("MyWeb");
  },
});
{
  "name": "dark-debris",
  "type": "module",
  "version": "0.0.1",
  "scripts": {
    "astro": "astro",
    "build": "astro check && astro build",
    "dev": "sst dev astro dev",
    "preview": "astro preview",
    "start": "astro dev"
  },
  "dependencies": {
    "@astrojs/check": "^0.7.0",
    "astro": "^4.10.1",
    "astro-sst": "2.43.0",
    "sst": "ion",
    "typescript": "^5.4.5"
  }
}

astro.config.mjs

import { defineConfig } from "astro/config";

// https://astro.build/config
export default defineConfig({});
ironbyte commented 3 weeks ago

TL;DR: Skill issue.

Ok, somebody kindly helped me with fixing this issue on SST Discord server. Apparently, my Astro config missed a few mandatory lines. So I updated mine to look like this:

import { defineConfig } from "astro/config";
import aws from "astro-sst";

// https://astro.build/config
export default defineConfig({
  output: "server",
  adapter: aws(),
});
thdxr commented 2 weeks ago

when you ran sst init did it not print instructions to add that adapter?

ironbyte commented 2 weeks ago

@thdxr Hey,just checked now and yes it did print instructions after I ran sst init in a new Astro project. All's good now. Uh, They were dark for me to notice:

image