Jets Endpoint URL giving timeout with Deploying Rails application using After Burner

question

#1

I have followed this link here: https://rubyonjets.com/docs/rails/afterburner/ to include jets on my rails application. After executing jets deploy command it successfully executed and returned me an Endpoint: https://tovnmx1hb9.execute-api.us-east-1.amazonaws.com/dev/users.
After opening this endpoint I am getting the following message:

message: “Endpoint request timed out”

Can you please help me whats wrong going on here ?

Thanks


#2

See:

The first link mentions:

Try going up farther in the CloudWatch logs and see if you can find an error about rackup failing to start. That is the key. Was able to just deploy the tongueroo/demo-rails-api 1 app with Jets Afterburner mode successfully. So, at this point think it’s project specific issue :face_with_monocle: Try to go farther up the CloudWatch logs to find out where rackup is failing to start.

Jets starts the rack server during the cold start for performance. So you have to find the request with the cold start.

Also, just deployed the https://github.com/tongueroo/demo-rails app and it was ok. It may be specific to your setup :face_with_monocle: Would also try spinning up a cloud9 machine and deploying the demo-app from there. That may help eliminate specific setup issues.


#3

I have checked the logs but found no errors in the logs. Here are the full details of my approach.

basically I have an application and was getting the timeout message in the browser after hitting the API URl. Then I tried it with your demo-rails app to see if it works or not. It does not work either and getting the same timeout message.

Full Code can be seen here. I hjust have used Postgresql and different rails version

https://github.com/hamza-sondermarketing/demo-rails-lambda


#4

Please have a view on my below Gemfile, Gemfil.lock, Api URL and cloudwatch Logs and assist me what I am doing wrong here.

Gemfile:

source 'https://rubygems.org'


git_source(:github) do |repo_name|
  repo_name = "
  "https://github.com/
end

gem 'rails', '~> 5.2.4', '>= 5.2.4.2'

gem "pg", "~> 1.1.3"

gem 'puma', '= 3.12.0'

gem 'sass-rails', '~> 5.0'

gem 'uglifier', '>= 1.3.0'

gem 'therubyracer', platforms: :ruby 

gem 'coffee-rails', '~> 4.2'

gem 'turbolinks', '~> 5'

gem 'jbuilder', '~> 2.5'

group :development, :test do
  
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  
  gem 'capybara', '~> 2.13'
  gem 'selenium-webdriver'
end

group :development do
  
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem "jets-rails"

Endpoint URL:
https://lo4lne31h5.execute-api.us-east-1.amazonaws.com/dev

CloudWatch Logs:
In the logs I can only see that the Jets::RackController#process got timedout after 30 seconds. Please see the below logs

12:50:55

START RequestId: cfa03e9e-a691-47ab-8629-fa9526dda4d8 Version: $LATEST



12:50:55

=&gt; unzip -qo /tmp/rack-1a8399c2.zip -d /tmp/rack



12:50:55

[DEPRECATED] `Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` (called at /opt/ruby/gems/2.5.0/gems/jets-2.3.15/lib/jets/rack_server.rb:37)



12:50:57

=&gt; cd /var/task/rack &amp;&amp; bin/rackup --host 127.0.0.1



12:50:57

Puma starting in single mode...



12:50:57

* Version 3.12.0 (ruby 2.5.7-p206), codename: Llamas in Pajamas



12:50:57

* Min threads: 5, max threads: 5



12:50:57

* Environment: development



12:50:57

* Listening on tcp://127.0.0.1:9292



12:50:57

Use Ctrl-C to stop



12:50:57

Connected to localhost:9292 successfully



12:50:57

I, [2020-04-06T12:50:57.346070 #8] INFO -- : Prewarm request



12:50:57

END RequestId: cfa03e9e-a691-47ab-8629-fa9526dda4d8



12:50:57

REPORT RequestId: cfa03e9e-a691-47ab-8629-fa9526dda4d8 Duration: 3.56 ms Billed Duration: 100 ms Memory Size: 1536 MB Max Memory Used: 229 MB Init Duration: 4341.83 ms



12:51:13

START RequestId: 525153df-2fa6-4010-a3b9-d67f3e428675 Version: $LATEST



12:51:13

I, [2020-04-06T12:51:13.034106 #8] INFO -- : Started GET "/" for 72.255.51.206 at 2020-04-06 12:51:13 +0000



12:51:13

I, [2020-04-06T12:51:13.034167 #8] INFO -- : Processing Jets::RackController#process



12:51:13

I, [2020-04-06T12:51:13.035021 #8] INFO -- : Event: {"resource":"/","path":"/","httpMethod":"GET","headers":{"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-US,en;q=0.9","cache-control":"max-age=0","CloudFront-Forwarded-Proto":"https","CloudFront-Is-Deskt



12:51:13

I, [2020-04-06T12:51:13.035291 #8] INFO -- : Parameters: {}



12:51:43

END RequestId: 525153df-2fa6-4010-a3b9-d67f3e428675



12:51:43

REPORT RequestId: 525153df-2fa6-4010-a3b9-d67f3e428675 Duration: 30030.15 ms Billed Duration: 30000 ms Memory Size: 1536 MB Max Memory Used: 244 MB



12:51:43

2020-04-06T12:51:43.048Z 525153df-2fa6-4010-a3b9-d67f3e428675 Task timed out after 30.03 seconds



12:51:45

=&gt; unzip -qo /tmp/rack-1a8399c2.zip -d /tmp/rack



12:51:45

[DEPRECATED] `Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` (called at /opt/ruby/gems/2.5.0/gems/jets-2.3.15/lib/jets/rack_server.rb:37)



12:51:45

=&gt; cd /var/task/rack &amp;&amp; bin/rackup --host 127.0.0.1



12:51:46

Puma starting in single mode...



12:51:46

* Version 3.12.0 (ruby 2.5.7-p206), codename: Llamas in Pajamas



12:51:46

* Min threads: 5, max threads: 5



12:51:46

* Environment: development



12:51:46

* Listening on tcp://127.0.0.1:9292



12:51:46

Use Ctrl-C to stop



12:51:47

Connected to localhost:9292 successfully



12:58:37

START RequestId: 2b6b0e7d-9543-40e4-a04f-07836765fcdb Version: $LATEST



12:58:37

I, [2020-04-06T12:58:37.260763 #9] INFO -- : Prewarm request



12:58:37

END RequestId: 2b6b0e7d-9543-40e4-a04f-07836765fcdb



12:58:37

REPORT RequestId: 2b6b0e7d-9543-40e4-a04f-07836765fcdb Duration: 2.75 ms Billed Duration: 100 ms Memory Size: 1536 MB Max Memory Used: 187 MB

#5

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (5.2.4.2)
      actionpack (= 5.2.4.2)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailer (5.2.4.2)
      actionpack (= 5.2.4.2)
      actionview (= 5.2.4.2)
      activejob (= 5.2.4.2)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.2.4.2)
      actionview (= 5.2.4.2)
      activesupport (= 5.2.4.2)
      rack (~> 2.0, >= 2.0.8)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.2.4.2)
      activesupport (= 5.2.4.2)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (5.2.4.2)
      activesupport (= 5.2.4.2)
      globalid (>= 0.3.6)
    activemodel (5.2.4.2)
      activesupport (= 5.2.4.2)
    activerecord (5.2.4.2)
      activemodel (= 5.2.4.2)
      activesupport (= 5.2.4.2)
      arel (>= 9.0)
    activestorage (5.2.4.2)
      actionpack (= 5.2.4.2)
      activerecord (= 5.2.4.2)
      marcel (~> 0.3.1)
    activesupport (5.2.4.2)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    addressable (2.7.0)
      public_suffix (>= 2.0.2, < 5.0)
    arel (9.0.0)
    bindex (0.8.1)
    builder (3.2.4)
    byebug (11.1.1)
    capybara (2.18.0)
      addressable
      mini_mime (>= 0.1.3)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (>= 2.0, < 4.0)
    childprocess (3.0.0)
    coffee-rails (4.2.2)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    concurrent-ruby (1.1.6)
    crass (1.0.6)
    erubi (1.9.0)
    execjs (2.7.0)
    ffi (1.12.2)
    globalid (0.4.2)
      activesupport (>= 4.2.0)
    i18n (1.8.2)
      concurrent-ruby (~> 1.0)
    jbuilder (2.10.0)
      activesupport (>= 5.0.0)
    jets-rails (0.2.0)
      rails (~> 5)
    libv8 (3.16.14.19)
    listen (3.1.5)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
      ruby_dep (~> 1.2)
    loofah (2.4.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.1)
      mini_mime (>= 0.1.1)
    marcel (0.3.3)
      mimemagic (~> 0.3.2)
    method_source (1.0.0)
    mimemagic (0.3.4)
    mini_mime (1.0.2)
    mini_portile2 (2.4.0)
    minitest (5.14.0)
    nio4r (2.5.2)
    nokogiri (1.10.9)
      mini_portile2 (~> 2.4.0)
    pg (1.1.4)
    public_suffix (4.0.3)
    puma (3.12.0)
    rack (2.2.2)
    rack-test (1.1.0)
      rack (>= 1.0, < 3)
    rails (5.2.4.2)
      actioncable (= 5.2.4.2)
      actionmailer (= 5.2.4.2)
      actionpack (= 5.2.4.2)
      actionview (= 5.2.4.2)
      activejob (= 5.2.4.2)
      activemodel (= 5.2.4.2)
      activerecord (= 5.2.4.2)
      activestorage (= 5.2.4.2)
      activesupport (= 5.2.4.2)
      bundler (>= 1.3.0)
      railties (= 5.2.4.2)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.3.0)
      loofah (~> 2.3)
    railties (5.2.4.2)
      actionpack (= 5.2.4.2)
      activesupport (= 5.2.4.2)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.19.0, < 2.0)
    rake (13.0.1)
    rb-fsevent (0.10.3)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    ref (2.0.0)
    ruby_dep (1.5.0)
    rubyzip (2.3.0)
    sass (3.7.4)
      sass-listen (~> 4.0.0)
    sass-listen (4.0.0)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
    sass-rails (5.1.0)
      railties (>= 5.2.0)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    selenium-webdriver (3.142.7)
      childprocess (>= 0.5, < 4.0)
      rubyzip (>= 1.2.2)
    sprockets (3.7.2)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.1)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    therubyracer (0.12.3)
      libv8 (~> 3.16.14.15)
      ref
    thor (1.0.1)
    thread_safe (0.3.6)
    tilt (2.0.10)
    turbolinks (5.2.1)
      turbolinks-source (~> 5.2)
    turbolinks-source (5.2.0)
    tzinfo (1.2.6)
      thread_safe (~> 0.1)
    uglifier (4.2.0)
      execjs (>= 0.3.0, < 3)
    web-console (3.7.0)
      actionview (>= 5.0)
      activemodel (>= 5.0)
      bindex (>= 0.4.0)
      railties (>= 5.0)
    websocket-driver (0.7.1)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.4)
    xpath (3.2.0)
      nokogiri (~> 1.8)

PLATFORMS
  ruby

DEPENDENCIES
  byebug
  capybara (~> 2.13)
  coffee-rails (~> 4.2)
  jbuilder (~> 2.5)
  jets-rails
  listen (>= 3.0.5, < 3.2)
  pg (~> 1.1.3)
  puma (= 3.12.0)
  rails (~> 5.2.4, >= 5.2.4.2)
  sass-rails (~> 5.0)
  selenium-webdriver
  therubyracer
  turbolinks (~> 5)
  tzinfo-data
  uglifier (>= 1.3.0)
  web-console (>= 3.3.0)

BUNDLED WITH
   2.1.4

#6

I have fixed the issue, The issue was the RDS configurations to allow permission rules to inbound and outbound calls