sst / ion

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

Live workers do not work with RPC calls #331

Open Ernxst opened 5 months ago

Ernxst commented 5 months ago

Relating to #321, it seems live workers do not work when calling other RPC workers (sst v0.0.330).

Steps to reproduce:

  1. Clone repo
  2. Set environment variables and install providers (with sst install)
  3. Run sst dev
  4. Add a log statement in the handler of packages/functions/src/workerA.ts
  5. Invoke the url of WorkerA

The corresponding log statement is not present in the terminal where sst dev is running, hence, I can only assume the request wasn't proxied to my machine and it invoked the deployed (now older) version instead. WorkerA calls WorkerB via workers RPC - I see live changes to my workers after removing the call to WorkerB. Assuming this is a bug and gets fixed, am I right in assuming that making a change in WorkerB will not be reflected when invoking WorkerA, since it's called over RPC, instead of HTTP?

Interestingly, when calling the fetch method of WorkerB instead, both workers are live (I observe changes made to either worker).

jayair commented 5 months ago

Can you try the latest? We might've pushed some changes.

Ernxst commented 5 months ago

Upgraded to 0.0.345 and now interestingly with worker B - a WorkerEntrypoint - and sorker A a exported object - which has a binding to B - updates to worker B are reflected in the logs when invoking A, but updates to A aren't seen

jayair commented 4 months ago

@Ernxst Can you share the step to reproduce this?

Ernxst commented 4 months ago

Hey @jayair - made another repro with 0.0.360 (newer versions aren't working for me - will file an issue).

  1. sst dev
  2. Invoke WorkerA using its url (e.g., in Postman, cURL etc.)
  3. Observe logs from sst dev
  4. Change the log statement in WorkerA
  5. Invoke WorkerA using its url (e.g., in Postman, cURL etc.)
  6. Observe logs from sst dev - the log statements are still the same

Instead of changing the log, you can also change the response returned - invoking WorkerA again still returns the old value.

Changing the log statement in WorkerB and invoking WorkerA again shows the updated WorkerB log in the terminal; changing the return value of WorkerB#sayHello and invoking WorkerA again will also use the updated return value.