softprops/serverless-rust

document story for what offline development looks like

softprops opened this issue · 5 comments

💡 Feature description

Local development keeps coming up as a common theme. Figure out and document the story for what this looks like, even if its just documenting how to set up serverless-offline.

💻 Basic example

add a second to the readme that outlines what is needed and how to do this with minimal friction

Trying to find a resolution to this myself.

Seems that the error message I keep getting is offline: Warning: found unsupported runtime 'rust' for function 'xzy'. Switching the order of the plugins does not seem to help. Though I am pretty sure offline needs to be after rust.

plugins:
  - serverless-rust
  - serverless-offline

Further confusing is that the source of this library re-writes the runtime as provided here so serverless offline should see it as provided not rust. Going to keep investigating.

In fact, looking a little closer, it looks like serverless offline creates a representation of each lambda right after you run sls offline start here

To that end, it doesn't get re-written as the provided runtime until long after offline knows about its runtime it would seem. As one might imagine, I am not a genius at javascript seeing as I am spending time in the rust ecosystem so I could easily be wrong about that.

Maybe the approach is to do something similar in this repo where there is an internal list of rust functions that are rewritten as provided as soon as the plugin is loaded. Then later in the build function, you simply see if the lambda in question is one of the previously found rust functions and build it as we currently do.

I almost got this working with serverless offline --useDocker with the pull linked above. however I'm on a mac an the volume serverless offline was mounting wasn't permitted on a mac.