sst / ion

SST v3
https://sst.dev
MIT License
1.98k stars 229 forks source link

sst dev doesn't forward event bus links #598

Open mckamyk opened 3 months ago

mckamyk commented 3 months ago

The documentation says that we can use sst dev <command> to run the live lambdas, as well as whatever command to pull in the linked resources to that command, which is handy for development of UIs.

After implementing EventBus I noticed that it doesn't seem passing in needed envs to link the event bus.

sst dev env | grep AWS_
# Nothing returned
sst shell env | grep AWS_
# AWS_SECRET_ACCESS_KEY=jkfldsajkfld;sajklfdsaj
# AWS_SESSION_TOKEN=
# AWS_REGION=us-east-1
# AWS_ACCESS_KEY_ID=lkjsdlkjsddlfkj

For me, running a remix app, I get by just fine by running sst dev and sst shell bun dev in separate terminals.

Of course, this only impacts if the UI (or whatever command) utilizes and emits events to a bus.

I get this error on build (on render, really)

accessKeyId is a required option

    at new AwsClient (file:///Users/.../node_modules/aws4fetch/dist/aws4fetch.esm.mjs:31:36)
    at file:///Users/.../node_modules/sst/dist/aws/client.js:2:23
    at ModuleJob.run (node:internal/modules/esm/module_job:262:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:475:24)
    at async nodeImport (file:///Users/.../node_modules/vite/dist/node/chunks/dep-BcXSligG.js:53493:15)
    at async ssrImport (file:///Users/.../node_modules/vite/dist/node/chunks/dep-BcXSligG.js:53349:16)
    at async eval (/Users/.../redacted/function.ts:9:31)
    at async instantiateModule (file:///Users/.../node_modules/vite/dist/node/chunks/dep-BcXSligG.js:53408:5
jayair commented 3 months ago

@thdxr was this intended?

thdxr commented 3 months ago

i need a bit more information i think

if you are running sst dev <command> it will look for any receivers (eg your remix site) that exist in that directory and pull in whatever is linked

are you sure you have linked bus to your remix site?

mckamyk commented 3 months ago

Yep, bus is linked. (works fine deployed to prod)

Would it matter if I'm working in a monorepo, and all of my event handlers are in different packages than remix?

could probably throw together a replication repo for ya