Closed npc-adrian closed 5 years ago
Currently only Python is supported. You can track Ruby update in this issue: #806
Closing as duplicate
Hi, @jfuss how would you suggest I proceed? I'm just trying to get started and the Hello World example doesn't seem to work in Ruby (or go or node - I tried them too). That doesn't seem right to me so I must be missing something.
All examples have README.md files that you should follow. This will show you the flow that you will need to follow.
Thanks @jfuss. That's solved things for me.
Have you considered updating the Hello World documentation to remove the build step?
My reasons for doing so would be...
It's not supported for all runtimes (hence this conversation)
Previously (before build), the Quickstart examples where specific to Python with no way to replicate the flow to any other language. This was because you needed to copy your source code into a build folder manually, which was only specific to Python. With the introduction of sam build
, this allows us to formulate this workflow into a command that can span each different runtime or language. So the example is support to only work in Python. We could document this but then each release we are tied to a doc update. Instead and since the first example only ever worked for Python, we left it as is and will roll out languages. The command output is also pretty clear on why 'build' didn't work.
As a beginner, it's not really clear to me what the benefit of building locally would be. It seems you don't need it to work locally on an app so I'm guessing it's useful in a more advanced use case I haven't encountered
If you have dependencies, you absolutely need to build, install requirements/dependencies, compile your code to the right architecture and os. You need build if you meet this requirement. sam build
gives us a way to make this runtime agnostic.
It appears to break hot reload based on my observations
Hot reloading still works. Previously, you needed to copy your source into a build directory (for Python) or compiling a binary before invoking the function. The way invokes work (sam local [invoke|start-api|start-lambda]
) is the template is read, code location is found, and then mounted. This means you can do hot reloading but you may need to run sam build
in a different terminal window or copy the edited file(s) or recompile the binary to where the CodeUri
points. Invokes never hot reloaded to the affect of build previously but can be solved through sam build --watch
command we are looking to add or make the invoke path also build.
Hi @jfuss,
Ok, I finally got the point of SAM build. Thanks for clarifying. Although everything you have said is correct, I still feel that the introductory docs could be improved as they are confusing for beginners.
We could document this but then each release we are tied to a doc update.
An alternative would be to say that support for other runtimes is being rolled and so you should check the readme generated by sam init
.
The command output is also pretty clear on why 'build' didn't work.
Do you mean Error: 'ruby2.5' runtime is not supported
? Yes, that's right but it doesn't give a novice any guidance on how to resolve the issue.
Referring the me to the generated readme would have helped in this case too.
Hot reloading still works...but you may need to run sam build
Ah ok, that would explain my issue. It's obvious with hindsight but it wasn't at the time.
Description
A basic ruby2.5 app generated using
sam init
fails to build locally.Steps to reproduce
sam init --runtime ruby2.5 -n rsam
cd rsam
sam build --use-container
Observed result
Expected result
Having completed the quick start in Python, I'm attempting to replicate the example app using ruby.
I'd expect the app to build locally.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Add --debug flag to command you are running