sst / ion

SST v3
https://sst.dev
MIT License
1.88k stars 221 forks source link

Broken sst.cloudflare.StaticSite on 0.0.393 #478

Closed gnllucena closed 4 months ago

gnllucena commented 4 months ago

When I try to deploy a StaticSite with the config bellow:

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

export default $config({
  app(input) {
    return {
      name: "app01",
      home: "cloudflare",
      removal: input?.stage === "production" ? "retain" : "remove",
    }
  },
  async run() {
    const server = new sst.cloudflare.Worker("Server", {
      url: true,
      handler: "apps/server/index.ts",
      environment: {
        NODE_ENV: "production",
      },
    })

    const web = new sst.cloudflare.StaticSite("Web", {
      path: "apps/web",
      build: {
        command: "pnpm run build",
        output: "dist",
      },
      environment: {
        VITE_SERVER_URL: server.url.apply((url) => url || ""),
      },
    })

    return {
      server: server.url,
      web: web.url,
    }
  },
})

I receive this error:

SST ❍ ion 0.0.393  ready!

➜  App:        app01
   Stage:      gnllucena

~  Deploying

Running "pnpm run build" script
> web@0.0.0 build /Users/gnllucena/git/app01/apps/web
> tsc && vite build
♻️  Generating routes...
✅ Processed routes in 104ms
vite v5.1.4 building for production...
transforming...
✓ 195 modules transformed.
rendering chunks...
computing gzip size...
dist/index.html                       0.46 kB │ gzip:  0.30 kB
dist/assets/index-0fv_dB7O.css        5.41 kB │ gzip:  1.66 kB
dist/assets/index.lazy-xgB_N5Z1.js    0.24 kB │ gzip:  0.21 kB
dist/assets/about.lazy-QQhvnPxm.js    0.33 kB │ gzip:  0.26 kB
dist/assets/index-ppOQOCgx.js       306.85 kB │ gzip: 95.37 kB
✓ built in 850ms
Could not resolve "sst"
3 │       import { wrapCloudflareHandler } from "sst"
|  Error        Error: 
|  <stdin>
|  
|  at file:///Users/gnllucena/git/app01/.sst/platform/src/components/cloudflare/worker.ts:386:17
|  at processTicksAndRejections (node:internal/process/task_queues:95:5) {
|  promise: Promise { <rejected> [Circular *1] }
|  }

×  Failed
   Error: 
   <stdin>

       at file:///Users/gnllucena/git/app01/.sst/platform/src/components/cloudflare/worker.ts:386:17
       at processTicksAndRejections (node:internal/process/task_queues:95:5) {
     promise: Promise { <rejected> [Circular *1] }
   }
jayair commented 4 months ago

We haven't released this yet. I'll close this for now.

ImLunaHey commented 3 months ago

@jayair should this not stay open until its fixed? i just tried using this based on the docs and got the same issue.

jonlambert commented 1 month ago

Just ran into this too. It's quite confusing to have it available in the config but then receive a cryptic error like this and have to go diving into closed issues to understand why.