Git Product home page Git Product logo

lamby-cookiecutter's People

Contributors

metaskills avatar toydestroyer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lamby-cookiecutter's Issues

RailsLambda may not have authorization defined.

I am trying to deploy the cookiecutter but cannot figure out how to get past this... I have tried both on my machine and on github actions and I am getting the same error.

Any ideas how to get past this? Cheers

Error: Failed to create changeset for the stack: salesmock-lambda-production, An error occurred (ValidationError) when calling the CreateChangeSet operation: Stack:arn:aws:cloudformation:us-east-1:188234749246:stack/salesmock-lambda-production/06df2aa0-46bf-11ed-956c-0a183a2d2989 is in ROLLBACK_COMPLETE state and can not be updated.

Github actions failed to run Deploy

Hi there

I am trying to setup the deployment on github actions using Devcontainers.

I am receiving the error below:
` Setting DockerBuildArgs: {} for RailsLambda function

Failed building function RailsLambda

Build Failed

Error: The command '/bin/sh -c gem install 'aws_lambda_ric'' returned a non-zero code: 1

Error: Dev container exec failed: (exit code: 1)
Error: Dev container exec failed: (exit code: 1)

Also I was previously receiving errors caused by these lines in the deploy.yml file:
imageName: ghcr.io/lanks/{% include "_cctmp/dash_name.txt" %}-devcontainer cacheFrom: ghcr.io/lanks/{% include "_cctmp/dash_name.txt" %}-devcontainer

The error I received was:

  [2023-12-01T08:55:29.408Z] ERROR: parse error on line 1, column 33: bare " in non-quoted-field
  [2023-12-01T08:55:29.411Z] Service 'app' failed to build : Build failed
  [2023-12-01T08:55:29.466Z] Exit code 1

I updated these lines and it worked but I am not sure if I need these lines for the container names?
imageName: ghcr.io/lanks/sm-devcontainer cacheFrom: ghcr.io/lanks/sm-devcontainer

Appreciate any help if anyone knows how to overcome these? Cheers

Quick start results in internal server error

I am running Mac OS 13.

If I do the quick start:

docker run \
  --rm \
  --interactive \
  --volume "${PWD}:/var/task" \
  ghcr.io/customink/lamby-cookiecutter \
  "gh:customink/lamby-cookiecutter"

and then deploy immediately

./bin/deploy

Then the resulting lambda has an internal server error. If I read the CloudWatch logs I see this:

/usr/local/lib/ruby/3.1.0/bundler/definition.rb:507:in `materialize': Could not find mysql2-0.5.4, debug-1.7.1, webrick-1.7.0, web-console-4.2.0, capybara-3.38.0, selenium-webdriver-4.7.1, webdrivers-5.2.0, irb-1.6.2, reline-0.3.2, bindex-0.8.1, addressable-2.8.1, matrix-0.4.2, nokogiri-1.13.10-x86_64-linux, regexp_parser-2.6.1, xpath-3.2.0, rexml-3.2.5, rubyzip-2.3.2, websocket-1.2.9, nio4r-2.5.8, websocket-driver-0.7.5, io-console-0.6.0, public_suffix-5.0.1, racc-1.6.2, date-3.3.3 in locally installed gems (Bundler::GemNotFound)

I'd say I'm doing something wrong but I have used the cookie cutter template and so I haven't actually done anything... or am I missing something?

Allow a rails api only build

How can I build an api-only app instead of a full rails app?
I noticed a _rails-new bin file, but it seems it isn't used during the sam init process, so adding the --api flag in there in my fork didn't do much.

I also tried adding the lamby gem to a new rails api setup, but got errors in aws about the gems not being found after deployment. So I'm not sure what is the best way to proceed

Cannot access lamby-cookiecutter image

First: Thank you for your work on this very cool project.

I'm probably messing this up myself but when I enter the very first command in the quickstart

docker run \
  --rm \
  --interactive \
  --volume "${PWD}:/var/task" \
  ghcr.io/rails-lambda/lamby-cookiecutter \
  "gh:rails-lambda/lamby-cookiecutter"

Docker is unable to find image 'ghcr.io/rails-lambda/lamby-cookiecutter:latest' locally (reasonable). But when it goes out to ghcr.io to get the image I get the following error

docker: Error response from daemon: Head "https://ghcr.io/v2/rails-lambda/lamby-cookiecutter/manifests/latest": unauthorized.

Did I miss something or did a switch get flipped and now the ghcr repo needs authentication?

where is config/environment.Lamby.cmd ?

Hello

I have tried version 4 to deploy a new rails app using steps at https://lamby.custominktech.com/docs/quick-start, I got this error below right after deployment:

Executing 'config/environment.Lamby.cmd' in function directory '/app'
--
  | 2022-12-26T16:19:58.668+03:00CopyInit error when loading handler | Init error when loading handler
  | 2022-12-26T16:19:58.668+03:00 | {
  | 2022-12-26T16:19:58.668+03:00 | "errorMessage": "cannot load such file -- mail/indifferent_hash",
  | 2022-12-26T16:19:58.668+03:00 | "errorType": "Init<LoadError>",
  | 2022-12-26T16:19:58.668+03:00 | "stackTrace": [
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/mail-2.8.0/lib/mail.rb:14:in `<module:Mail>'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/mail-2.8.0/lib/mail.rb:3:in `<top (required)>'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/actionmailer-7.0.4/lib/action_mailer/base.rb:3:in `<top (required)>'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/app/mailers/application_mailer.rb:1:in `<top (required)>'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:30:in `require'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:30:in `require'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:135:in `const_get'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:135:in `cget'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:169:in `block in actual_eager_load_dir'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:40:in `block in ls'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:25:in `each'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:25:in `ls'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:164:in `actual_eager_load_dir'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:17:in `block (2 levels) in eager_load'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:16:in `each'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:16:in `block in eager_load'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:10:in `synchronize'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:10:in `eager_load'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:296:in `block in eager_load_all'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:294:in `each'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:294:in `eager_load_all'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/railties-7.0.4/lib/rails/application/finisher.rb:74:in `block in <module:Finisher>'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:32:in `instance_exec'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:32:in `run'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:61:in `block in run_initializers'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/lib/ruby/3.1.0/tsort.rb:347:in `each'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/lib/ruby/3.1.0/tsort.rb:347:in `call'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/railties-7.0.4/lib/rails/initializable.rb:60:in `run_initializers'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/vendor/bundle/ruby/3.1.0/gems/railties-7.0.4/lib/rails/application.rb:372:in `initialize!'",
  | 2022-12-26T16:19:58.668+03:00 | "/app/config/environment.rb:5:in `<top (required)>'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:41:in `require'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:41:in `run'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:35:in `bootstrap_handler'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:8:in `start'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/bin/aws_lambda_ric:10:in `<top (required)>'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/bundle/bin/aws_lambda_ric:25:in `load'",
  | 2022-12-26T16:19:58.668+03:00 | "/usr/local/bundle/bin/aws_lambda_ric:25:in `<main>'"
  | 2022-12-26T16:19:58.668+03:00 | ]

Where is config/environment.Lamby.cmd ? shouldn't it work out of the box as per the documentation ?

It looks like you're trying to use Nokogiri as a precompiled native gem on a system with glibc < 2.17

Hi Custom Ink devs,

I am going through the lamby quickstart. And I believe I'm encountering an issue because I'm using Apple Silicon. I'll keep looking into it but I thought I would share.

On the ./bin/deploy step I am getting the following error (note I changed set -x to set -eux):

== Asset Hosts & Precompiling ==
+ NODE_ENV=production
+ ./bin/rails assets:precompile

ERROR: It looks like you're trying to use Nokogiri as a precompiled native gem on a system with glibc < 2.17:

  /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so) - /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so

  If that's the case, then please install Nokogiri via the `ruby` platform gem:
      gem install nokogiri --platform=ruby
  or:
      bundle config set force_ruby_platform true

  Please visit https://nokogiri.org/tutorials/installing_nokogiri.html for more help.


ERROR: It looks like you're trying to use Nokogiri as a precompiled native gem on a system with glibc < 2.17:

  /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so) - /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so

  If that's the case, then please install Nokogiri via the `ruby` platform gem:
      gem install nokogiri --platform=ruby
  or:
      bundle config set force_ruby_platform true

  Please visit https://nokogiri.org/tutorials/installing_nokogiri.html for more help.

rails aborted!
LoadError: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so) - /var/task/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.13.3-aarch64-linux/

Typo in Gemfile: "aws-skd-ssm" ?

I'm just trying Lamby tutorial but ./bin/setup failed.

$ ./bin/setup
Creating lamby_sample_lamby-sample_run ... done
== Installing dependencies ==
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
Fetching gem metadata from https://rubygems.org/.............         
Fetching gem metadata from https://rubygems.org/.
Could not find gem 'aws-skd-ssm x86_64-linux' in any of the gem sources listed in your Gemfile.

Is aws-skd-ssm a typo for aws-sdk-ssm ?

https://github.com/customink/lamby-cookiecutter/blob/d3e89f7ea10bac5c9ab18699ee44a4170195c6b5/lambify/Gemfile#L6

I try to fix it and re-run ./bin/setup then bundler has run succeeded.

Misc Fixes & Enhancements

  • Dotenv - Add require 'dotenv/rails-now' in application.rb via standard docs.
  • Assets - Why are assets working even when we did not do this in assets.rb? Rails.application.config.assets.manifest = Rails.root.join('config/manifest.json'). Where is the manifest stored? Public?

"errorMessage": "uninitialized constant Rack::RACK_MULTITHREAD"

I followed this guide throughoutly, I even switched between arm amd architecture.
https://lamby.cloud/docs/quick-start.

However, I got this error when accessing function URL:



2023-10-27T18:32:08.670+07:00 | Executing 'config/environment.Lamby.cmd' in function directory '/app'
-- | --
  | 2023-10-27T18:32:11.579+07:00 | EXTENSION Name: crypteia State: Ready Events: [INVOKE, SHUTDOWN]
  | 2023-10-27T18:32:11.581+07:00 | START RequestId: e92dc6d6-3e03-4967-9620-44a5b05fa74a Version: 3
  | 2023-10-27T18:32:11.584+07:00 | Critical exception from handler
  | 2023-10-27T18:32:11.585+07:00 | {
  | 2023-10-27T18:32:11.585+07:00 | "errorMessage": "uninitialized constant Rack::RACK_MULTITHREAD",
  | 2023-10-27T18:32:11.585+07:00 | "errorType": "Function<NameError>",
  | 2023-10-27T18:32:11.585+07:00 | "stackTrace": [
  | 2023-10-27T18:32:11.585+07:00 | "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby/rack_http.rb:45:in `env_base'",
  | 2023-10-27T18:32:11.585+07:00 | "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby/rack.rb:33:in `env'",
  | 2023-10-27T18:32:11.585+07:00 | "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby/handler.rb:89:in `call_app'",
  | 2023-10-27T18:32:11.585+07:00 | "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby/handler.rb:47:in `call'",
  | 2023-10-27T18:32:11.585+07:00 | "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby/handler.rb:8:in `call'",
  | 2023-10-27T18:32:11.585+07:00 | "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby.rb:31:in `handler'",
  | 2023-10-27T18:32:11.585+07:00 | "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby.rb:25:in `cmd'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/lambda_handler.rb:26:in `call_handler'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:81:in `run_user_code'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:59:in `start_runtime_loop'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:42:in `run'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:35:in `bootstrap_handler'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:8:in `start'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/bin/aws_lambda_ric:10:in `<top (required)>'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/bin/aws_lambda_ric:25:in `load'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/bin/aws_lambda_ric:25:in `<main>'"
  | 2023-10-27T18:32:11.585+07:00 | ]
  | 2023-10-27T18:32:11.585+07:00 | }
  | 2023-10-27T18:32:11.585+07:00 | Init error when loading handler
  | 2023-10-27T18:32:11.585+07:00 | {
  | 2023-10-27T18:32:11.585+07:00 | "errorMessage": "wrong number of arguments (given 4, expected 2..3)",
  | 2023-10-27T18:32:11.585+07:00 | "errorType": "Init<ArgumentError>",
  | 2023-10-27T18:32:11.585+07:00 | "stackTrace": [
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:109:in `send_error_response'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:98:in `rescue in run_user_code'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:77:in `run_user_code'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:59:in `start_runtime_loop'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:42:in `run'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:35:in `bootstrap_handler'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:8:in `start'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/bin/aws_lambda_ric:10:in `<top (required)>'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/bin/aws_lambda_ric:25:in `load'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/bin/aws_lambda_ric:25:in `<main>'"
  | 2023-10-27T18:32:11.585+07:00 | ]
  | 2023-10-27T18:32:11.585+07:00 | }

Surprisingly, if I invoke the function manually, it only returned 404. The error only occurs when I used Function URL or API Gateway request.

Awesome!! Minor docs suggestion

Thanks for Putting This Out There!!!
I used your lamby quickstart and it was amazing -- I have it running! I've been a Rails dev on AWS for a long time and have been hoping to play with Lambda and Rails but haven't had the reason to spend the time. I haven't spent any time with Docker so that was an experiment I was interested to embrace as well. Then I came across lamby and I got everything at once! I figured it's such a quick experiment why not give it a go. Your 5 minutes got me!

Docs Suggestion
The only negative in my story is that it wasn't 5 minutes, it was more like a number of hours.

tldr; The docker-compose.yml specifies linux/amd64 which seemed to conflict with the docs saying everything is geared for ARM processing. Launching VS Code and running the dev container threw an error on my Apple M1 Laptop. I think it should be platform: linux/arm64.

More Details

Being such a newbie to docker specifically got me. The docs say:

Our starter defaults to an arm64 deployment target. If needed, see our CPU Architecture guide on how to switch to x86_64.

This misled me a bit because when I opened up the my_awesome_lambda project in VSCode and it attempted to "Start the Dev Container" it ended up failing with this error:

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: pull access denied, repository does not exist or may require authorization: server message: insufficient scope: authorization failed

CleanShot 2023-03-04 at 12 16 10@2x

My Fix

I needed to modify the docker-compose.yml file to platform: linux/arm64 from platform: linux/amd64. AMD and ARM are soooo close when it's late at night!

I was going to open a PR for you, but I couldn't find the docs repo. Let me know if I can help, or if I just have a fundamental misunderstanding about how this should have worked.

Use Makefile for Better Build

AWS SAM v0.51.0 (https://github.com/awslabs/aws-sam-cli/releases/tag/v0.51.0) now has custom build via a Makefile. I tried this on a few of our internal projects and it really helped speed up the build by allowing dev deps (typically installed for test on CI/CD) to be re-used for the asset compilation. This allowed us to to do our deployment bundle to a different directory within the the .aws-sam directory which essentially allowed us to cache both with GitHub Actions.

echo '== Cleaning dev dependencies =='
rm -rf ./vendor/bundle-dev

echo '== Bundle for deployment =='
bundle config --local deployment true
bundle config --local without 'development test'
bundle config --local path './vendor/bundle'
bundle install --quiet --jobs 4

Consider switching this cookiecutter to use a makefile for build.

Cookiecutter setup script fails with command not available error message

Attempting to run sam init --location "gh:customink/lamby-cookiecutter" and after entering the project name returns the following error

Command /tmp/tmpawy2lirz.py not available
...
Traceback (most recent call last):
  File "samcli/__main__.py", line 12, in <module>
  File "click/core.py", line 829, in __call__
  File "click/core.py", line 782, in main
  File "click/core.py", line 1259, in invoke
  File "click/core.py", line 1066, in invoke
  File "click/core.py", line 610, in invoke
  File "samcli/commands/init/__init__.py", line 128, in wrapped
  File "click/decorators.py", line 73, in new_func
  File "click/core.py", line 610, in invoke
  File "samcli/lib/telemetry/metric.py", line 166, in wrapped
  File "samcli/lib/telemetry/metric.py", line 124, in wrapped
  File "samcli/lib/utils/version_checker.py", line 41, in wrapped
  File "samcli/cli/main.py", line 87, in wrapper
  File "samcli/commands/init/__init__.py", line 281, in cli
  File "samcli/commands/init/__init__.py", line 350, in do_cli
  File "samcli/commands/init/init_generator.py", line 31, in do_generate
  File "samcli/lib/init/__init__.py", line 97, in generate_project
  File "cookiecutter/main.py", line 120, in cookiecutter
  File "cookiecutter/generate.py", line 374, in generate_files
  File "cookiecutter/generate.py", line 179, in generate_file
  File "jinja2/environment.py", line 1090, in render
  File "jinja2/environment.py", line 832, in handle_exception
  File "jinja2/_compat.py", line 28, in reraise
  File "./docker-compose.yml", line 3, in top-level template code
  File "jinja2/loaders.py", line 197, in get_source
jinja2.exceptions.TemplateNotFound: _cctmp/dash_name.txt
[29023] Failed to execute script __main__

I am running SAM v1.53.0 and Docker v20.10.17, build 100c701. My Python version is 3.8.10 and my Ruby version is 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux].

ActionView::Template::Error - application.css not present in asset pipeline

Running on macOS Sonoma 14.1.1 within the VS Code Dev Container. Deployed to AWS Lambda without any code changes.

Following error appears in CloudWatch when visiting the application URL:

Skipped bootstraping TelemetryLog
Executing 'config/environment.Lamby.cmd' in function directory '/app'
EXTENSION	Name: crypteia	State: Ready	Events: [INVOKE, SHUTDOWN]
START RequestId: 23179998-e9a5-47f1-a419-3a610288b33b Version: 1
{
    "method": "GET",
    "path": "/",
    "format": "html",
    "controller": "ApplicationController",
    "action": "index",
    "status": 500,
    "allocations": 1806,
    "duration": 12,
    "view": 0,
    "db": 0,
    "requestid": "23179998-e9a5-47f1-a419-3a610288b33b"
}

ActionView::Template::Error (The asset "application.css" is not present in the asset pipeline.
):
5:     <title>RailsLambdaApp</title>
6:     <%= csrf_meta_tags %>
7:     <%= csp_meta_tag %>
8:     <%= stylesheet_link_tag "application" %>
9:     <%= javascript_importmap_tags %>
10:   </head>
11:   <body>
app/views/layouts/application.html.erb:8
END RequestId: 23179998-e9a5-47f1-a419-3a610288b33b
REPORT RequestId: 23179998-e9a5-47f1-a419-3a610288b33b	Duration: 36.03 ms	Billed Duration: 9667 ms	Memory Size: 1792 MB	Max Memory Used: 151 MB	Init Duration: 9630.86 ms	
START RequestId: bc61eae5-df4a-4cd8-b433-c486c681f35c Version: 1
END RequestId: bc61eae5-df4a-4cd8-b433-c486c681f35c

Getting GemNotFound errors in Cloudwatch after deploy

I'm getting the following errors in Cloudwatch after deploy and can't get the site to load.

/usr/local/lib/ruby/3.2.0/bundler/definition.rb:524:in `materialize': Could not find web-console-4.2.1, capybara-3.39.2, selenium-webdriver-4.10.0, webdrivers-5.3.1, bindex-0.8.1, addressable-2.8.5, matrix-0.4.2, regexp_parser-2.8.1, xpath-3.2.0, rexml-3.2.6, rubyzip-2.3.2, websocket-1.2.10, nio4r-2.5.9, websocket-driver-0.7.6, bigdecimal-3.1.4, public_suffix-5.0.3, psych-5.1.0, stringio-3.0.8 in locally installed gems (Bundler::GemNotFound)

This is my GemFile:

source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gem "rails"

gem "importmap-rails"
gem "lamby"
gem 'sqlite3'
gem "sprockets-rails"
gem "stimulus-rails"
gem "turbo-rails"
gem "jbuilder"

group :development, :test do
  gem "webrick"
end

group :development do
  gem "web-console"
end

group :test do
  gem "capybara"
  gem "selenium-webdriver"
  gem "webdrivers"
end

group :production do
  gem 'lograge'
end

Would you know what could be causing this issue?

nginx

Hello

My rails app is currently running behind nginx, as I use some rules to proxy pass some locations so that they appear within my rails app urls, ex: myapp.com/forum which is proxy passed to discourse EC2 instance.

I can add a separate EC2 instance to use nginx as a proxy to my lambda url and have my rails container runs without nginx, however that will cost me extra ec2 server.

The question is, can I use lamby to point traffic to nginx instead of directly into my rails app in my container?

initial deploy fails due to webpack missing

Hi, I'm new to lamby and trying to test it out by running through the setup tasks on a pure cookiecutter project.

I was able to run bootstrap, and setup, however deploy fails

› ./bin/deploy
WARN[0000] The "AWS_ACCESS_KEY_ID" variable is not set. Defaulting to a blank string. 
WARN[0000] The "AWS_SECRET_ACCESS_KEY" variable is not set. Defaulting to a blank string. 
WARN[0000] The "CI" variable is not set. Defaulting to a blank string. 
== Lamby build ==
== Cleaning dev dependencies for local deploy. Run ./bin/setup again afterward! ==
== Bundle For Deployment ==
Writing lockfile to /var/task/Gemfile.lock
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this
machine.
== Environments & Configuration ==
== Asset Hosts & Precompiling ==
Compiling...
Compilation failed:
yarn run v1.22.17
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


error Command "webpack" not found.

Looking into the _build script, this sort of makes sense to me due to the script clearing out the node_modules directory here. https://github.com/customink/lamby-cookiecutter/blob/master/%7B%7Bcookiecutter.project_name%7D%7D/bin/_build#L5-L8

Perhaps I missed a step?

./bin/build is missing in the generated folder – The instructions for installing the projects are not working

Straight OOTB the project created didn't have a ./bin/build folder


➜  serverless_apps docker run \
  --rm \
  --interactive \
  --volume "${PWD}:/var/task" \
  ghcr.io/customink/lamby-cookiecutter \
  "gh:customink/lamby-cookiecutter"
Unable to find image 'ghcr.io/customink/lamby-cookiecutter:latest' locally
latest: Pulling from customink/lamby-cookiecutter
ca7dd9ec2225: Pull complete
9e124a36b9ab: Pull complete
edb4d319ce97: Pull complete
b8a071d6393e: Pull complete
91013de9d1f4: Pull complete
5cc7fe4bd869: Pull complete
6e7bde8dcf2d: Pull complete
Digest: sha256:3e3eefeada9fa214bed2e09ef79237ea427e35ca959cd00dc528c2a319e3e5f7
Status: Downloaded newer image for ghcr.io/customink/lamby-cookiecutter:latest
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
project_name [my_awesome_lambda]: project_lambda

➜  serverless_apps cd project_lambda

➜  project_lambda ./bin/build
zsh: no such file or directory: ./bin/build

➜  project_lambda cd bin/
➜  bin ls
deploy rails  rake   setup  test

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.