Giter Site home page Giter Site logo

rubyonjets / jets Goto Github PK

View Code? Open in Web Editor NEW
2.6K 37.0 178.0 16.27 MB

Ruby on Jets

Home Page: http://rubyonjets.com

License: MIT License

Ruby 97.57% JavaScript 0.04% Shell 0.52% HTML 1.66% CSS 0.16% Dockerfile 0.03% Procfile 0.01%
jets awslambda serverless ruby rubyonjets aws lambda

jets's Introduction

Ruby and Lambda had a baby and that child's name is Jets.

Build Status Gem Version Support

BoltOps Badge

Please watch/star this repo to help grow and support the project.

Upgrading: If you are upgrading Jets, please check on the Upgrading Notes.

What is Ruby on Jets?

Jets is a Ruby Serverless Framework. Jets allows you to create serverless applications with a beautiful language: Ruby. It includes everything required to build and deploy an application to AWS Lambda.

Understanding AWS Lambda and API Gateway is key to understanding Jets conceptually. Jets map your code to Lambda functions and other AWS Resources like API Gateway and Event Rules.

  • AWS Lambda is functions as a service. It allows you to upload and run functions without worrying about the underlying infrastructure.
  • API Gateway is the routing layer for Lambda. It is used to route REST URL endpoints to Lambda functions.
  • EventBridge Rules are events as a service. You can automatically run Lambda functions triggered from AWS services. You decide what events to catch and how to react to them.

The official documentation is at Ruby on Jets.

Refer to the official docs for more info, but here's a quick intro.

Jets Functions

Jets supports writing AWS Lambda functions with Ruby. You define them in the app/functions folder. A function looks like this:

app/functions/simple.rb:

def lambda_handler(event:, context:)
  puts "hello world"
  {hello: "world"}
end

Here's the function in the Lambda console:

Code Example in AWS Lambda console

Though simple functions are supported by Jets, they do not add as much value as other ways to write Ruby code with Jets. Classes like Controllers and Jobs add many conveniences and are more powerful to use. Weโ€™ll cover them next.

Jets Controllers

A Jets controller handles a web request and renders a response. Here's an example:

app/controllers/posts_controller.rb:

class PostsController < ApplicationController
  def index
    # renders Lambda Proxy structure compatible with API Gateway
    render json: {hello: "world", action: "index"}
  end

  def show
    id = params[:id] # params available
    # puts goes to the lambda logs
    puts event # raw lambda event available
    render json: {action: "show", id: id}
  end
end

Helper methods like params provide the parameters from the API Gateway event. The render method returns a Lambda Proxy structure that API Gateway understands.

Jets creates single Lambda functions to handle your Jets Controller requests. The Lambda Function handler is a shim that routes to your controller action.

Jets Routing

You connect Lambda functions to API Gateway URL endpoints with a routes file:

config/routes.rb:

Jets.application.routes.draw do
  resources :posts
  any "posts/hot", to: "posts#hot" # GET, POST, PUT, etc request all work
end

The routes.rb gets translated to API Gateway resources:

API Gateway Resources generated from routes in AWS console

Test your API Gateway endpoints with curl or postman. Note, replace the URL endpoint with the one that is created:

$ curl -s "https://quabepiu80.execute-api.us-east-1.amazonaws.com/dev/posts" | jq .
{
  "hello": "world",
  "action": "index"
}

Jets Jobs

A Jets job handles asynchronous background jobs outside the web request/response cycle. Here's an example:

app/jobs/hard_job.rb:

class HardJob < ApplicationJob
  rate "10 hours" # every 10 hours
  def dig
    puts "done digging"
  end

  cron "0 */12 * * ? *" # every 12 hours
  def lift
    puts "done lifting"
  end
end

Jets Jobs in AWS Lambda Console

HardJob#dig runs every 10 hours, and HardJob#lift runs every 12 hours. The rate and cron methods created CloudWatch Event Rules. Example:

CloudWatch Event Rules in AWS Console

This simple example uses Scheduled Events. There are many more possibilities, see the Events Docs.

Jets Deployment

You can test your application with a local server that mimics API Gateway: Jets Local Server. Once ready, deploying to AWS Lambda is a single command.

jets deploy

After deployment, you can test the Lambda functions with the AWS Lambda console or the CLI.

Live Demos

Here are some demos of Jets applications:

Please feel free to add your examples to the rubyonjets/examples repo.

More Info

For more documentation, check out the official docs: Ruby on Jets. Here's a list of useful links:

Learning Content

jets's People

Contributors

axel avatar bigwheel avatar ceritium avatar chrisbr avatar codinganarchy avatar dbackeus avatar eamsc avatar esmarkowski avatar galetahub avatar genail avatar gglee6352 avatar haeree-dev avatar heythisisnate avatar iqre8 avatar jacobherrington avatar jcomeaux avatar jdaviderb avatar jeremiahlukus avatar kmndouwrbeen4 avatar kuchitama avatar mveer99 avatar onnimonni avatar peiyee avatar prashcr avatar rwxdash avatar steffanperry avatar tanukiti1987 avatar tongueroo avatar triduongtran avatar tsribeiro 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  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  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  avatar  avatar  avatar  avatar

jets's Issues

Jets startup time is really long in local development with docker on MacOS

I'm seeing quite high waiting times (1m17s) before anything happens.

I'm running the latest jets gem (0.8.17) with ruby 2.5.1 and nodejs v10.11.0.

I shared my docker setup here: https://github.com/onnimonni/jets-project
Similar setup has been working really well for my rails projects.

These are the commands I used inside the docker container:

$ time jets generate scaffold Post title:string
      invoke  active_record
      create    db/migrate/20180922134209_create_posts.rb
      create    /models/post.rb
      invoke  resource_route
       route    resources :posts
      invoke  scaffold_controller
      create    /controllers/posts_controller.rb
      invoke    erb
      create      /views/posts
      create      /views/posts/index.html.erb
      create      /views/posts/edit.html.erb
      create      /views/posts/show.html.erb
      create      /views/posts/new.html.erb
      create      /views/posts/_form.html.erb
      invoke    helper
      create      /helpers/posts_helper.rb

real	1m17.385s
user	0m1.030s
sys	0m0.150s
$ time jets db:create
FATAL:  password authentication failed for user "dbuser"
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"utf8", "pool"=>"5", "database"=>"development", "username"=>"dbuser", "password"=>"dbpass", "host"=>"db"}
jets aborted!
PG::ConnectionBad: FATAL:  password authentication failed for user "dbuser"
...

Tasks: TOP => db:create
(See full trace by running task with --trace)

real	1m17.327s
user	0m0.920s
sys	0m0.230s

jets deploy fails

Deploy fails with
=> Copying current project directory to temporary build area: /tmp/jets/demo/stage/code Traceback (most recent call last): 15: from /usr/local/bundle/bin/jets:23:in

'
14: from /usr/local/bundle/bin/jets:23:in load' 13: from /usr/local/bundle/gems/jets-1.4.9/exe/jets:14:in <top (required)>'
12: from /usr/local/bundle/gems/jets-1.4.9/lib/jets/cli.rb:5:in start' 11: from /usr/local/bundle/gems/jets-1.4.9/lib/jets/cli.rb:21:in start'
10: from /usr/local/bundle/gems/jets-1.4.9/lib/jets/commands/base.rb:27:in perform' 9: from /usr/local/bundle/gems/jets-1.4.9/lib/jets/commands/base.rb:38:in dispatch'
8: from /usr/local/bundle/gems/thor-0.20.3/lib/thor.rb:387:in dispatch' 7: from /usr/local/bundle/gems/thor-0.20.3/lib/thor/invocation.rb:126:in invoke_command'
6: from /usr/local/bundle/gems/thor-0.20.3/lib/thor/command.rb:27:in run' 5: from /usr/local/bundle/gems/jets-1.4.9/lib/jets/commands/main.rb:21:in deploy'
4: from /usr/local/bundle/gems/jets-1.4.9/lib/jets/commands/deploy.rb:29:in run' 3: from /usr/local/bundle/gems/jets-1.4.9/lib/jets/commands/deploy.rb:49:in build_code'
2: from /usr/local/bundle/gems/jets-1.4.9/lib/jets/commands/build.rb:27:in build_code' 1: from /usr/local/bundle/gems/jets-1.4.9/lib/jets/builders/code_builder.rb:38:in build'
/usr/local/bundle/gems/jets-1.4.9/lib/jets/builders/code_builder.rb:38:in chdir': No such file or directory @ dir_chdir - /tmp/jets/demo/stage/code (Errno::ENOENT)

Feature Request: Support Timezones in cloudwatch triggers

I think timezones are not currently possible because the cron support in AWS cloudwatch is really limited.

It would be nice to have a feature in Jets which understands different timezones and converts them into multiple different UTC cron definitions.

Here's an example from serverless plugin which converts this config:

functions:
  hello:
    handler: handler.hello
    events:
      - schedule:
          rate: cron(0 10 * * ? *)
          timezone: America/New_York

To effectively do the same thing as this one

functions:
  hello:
    handler: handler.hello
    events:
      - schedule:
          rate: cron(0 15 * 1-2,12 ? *) # full non-DST months
      - schedule:
          rate: cron(0 15 1-10 3 ? *) # non-DST portion of March
      - schedule:
          rate: cron(0 14 11-31 3 ? *) # DST portion of March
      - schedule:
          rate: cron(0 14 * 4-10 ? *) # full DST months
      - schedule:
          rate: cron(0 14 1-3 11 ? *) # DST portion of November
      - schedule:
          rate: cron(0 15 4-31 11 ? *) # non-DST portion of November

This would make Jets even more user friendly for configuring jobs.

Feature Request: Trigger lambda function based on s3 or sqs event

I really enjoy how https://github.com/aws/chalice contains a nice way to trigger events based on sqs or s3 event like this:

from chalice import Chalice

app = Chalice(app_name="helloworld")

# Whenver an object is uploaded to 'mybucket'
# this lambda function will be invoked.

@app.on_s3_event(bucket='mybucket')
def handler(event):
    print("Object uploaded for bucket: %s, key: %s"
          % (event.bucket, event.key))

We could have something similiar in Jets.

I'm not sure if you already have something in mind to implement background job queues.

I'm thinking of using Jets to replace some of my data processing pipelines.
An example use case:

  1. Cloudwatch scheduled background job fetches file through sftp and saves it to s3
  2. Second lambda is triggered when there's a new file in the s3 bucket. It will parse the file and save the results to RDS.
  3. If the file had any errors, schedule an sqs event for another lambda which emails the error to given recipients.

This way the max execution time (5min) will be enough for almost any input.

And of course I don't want to overwhelm you with too many requests and I can try to implement this myself a bit later.

deploy failed: Did not specify @options[:s3_bucket] nil (RuntimeError)

Hi, i try to deploy but failed

jets 1.4.5
ruby 2.5.0

. . .
=> Replacing compiled gems with AWS Lambda Linux compiled versions: /tmp/jets/demo_api/stage/opt
Checking projects gems for pre-built Lambda gems...
Gem nokogiri-1.9.1 unpacked at /tmp/jets/demo_api/stage/opt
Gem mysql2-0.5.2 unpacked at /tmp/jets/demo_api/stage/opt
=> Generating shims in the handlers folder.
=> Creating zip file for /tmp/jets/demo_api/stage/opt
=> cd /tmp/jets/demo_api/stage/opt && zip --symlinks -rq opt.zip .
Zip file created at: /tmp/jets/demo_api/stage/zips/opt-db69d82a.zip (16.7 MB)
=> Creating zip file for /tmp/jets/demo_api/stage/code
=> cd /tmp/jets/demo_api/stage/code && zip --symlinks -rq code.zip .
Zip file created at: /tmp/jets/demo_api/stage/zips/code-817683ad.zip (21 KB)
Building CloudFormation templates.
Traceback (most recent call last):
	16: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `<main>'
	15: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `eval'
	14: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/bin/jets:23:in `<main>'
	13: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/bin/jets:23:in `load'
	12: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/gems/jets-1.4.5/exe/jets:14:in `<top (required)>'
	11: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/gems/jets-1.4.5/lib/jets/cli.rb:5:in `start'
	10: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/gems/jets-1.4.5/lib/jets/cli.rb:21:in `start'
	 9: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/gems/jets-1.4.5/lib/jets/commands/base.rb:27:in `perform'
	 8: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/gems/jets-1.4.5/lib/jets/commands/base.rb:38:in `dispatch'
	 7: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
	 6: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	 5: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	 4: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/gems/jets-1.4.5/lib/jets/commands/main.rb:21:in `deploy'
	 3: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/gems/jets-1.4.5/lib/jets/commands/deploy.rb:31:in `run'
	 2: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/gems/jets-1.4.5/lib/jets/commands/deploy.rb:67:in `ship'
	 1: from /Users/shukrikhalid/.rvm/gems/ruby-2.5.0/gems/jets-1.4.5/lib/jets/cfn/ship.rb:14:in `run'
/Users/shukrikhalid/.rvm/gems/ruby-2.5.0/gems/jets-1.4.5/lib/jets/cfn/ship.rb:172:in `upload_to_s3': Did not specify @options[:s3_bucket] nil (RuntimeError)

when I run jets deploy got error

s3 bucket is created but is empty

Deploy failed: cannot handle socket (RuntimeError)

Ubuntu 18.04
RVM
Rails: 5.2.2
Ruby: 2.5.3

 jets deploy                                                               
=> Rails app detected: Enabling Jets Afterburner to deploy to AWS Lambda.
Traceback (most recent call last):
	28: from /home/josue/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'
	27: from /home/josue/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
	26: from /home/josue/.rvm/gems/ruby-2.5.3/bin/jets:23:in `<main>'
	25: from /home/josue/.rvm/gems/ruby-2.5.3/bin/jets:23:in `load'
	24: from /home/josue/.rvm/gems/ruby-2.5.3/gems/jets-1.4.5/exe/jets:14:in `<top (required)>'
	23: from /home/josue/.rvm/gems/ruby-2.5.3/gems/jets-1.4.5/lib/jets/cli.rb:5:in `start'
	22: from /home/josue/.rvm/gems/ruby-2.5.3/gems/jets-1.4.5/lib/jets/cli.rb:20:in `start'
	21: from /home/josue/.rvm/gems/ruby-2.5.3/gems/jets-1.4.5/lib/jets/cli.rb:48:in `boot_jets'
	20: from /home/josue/.rvm/gems/ruby-2.5.3/gems/jets-1.4.5/lib/jets/core.rb:18:in `boot'
	19: from /home/josue/.rvm/gems/ruby-2.5.3/gems/jets-1.4.5/lib/jets/booter.rb:7:in `boot!'
	18: from /home/josue/.rvm/gems/ruby-2.5.3/gems/jets-1.4.5/lib/jets/booter.rb:31:in `turbo_charge'
	17: from /home/josue/.rvm/gems/ruby-2.5.3/gems/jets-1.4.5/lib/jets/turbo.rb:15:in `charge'
	16: from /home/josue/.rvm/gems/ruby-2.5.3/gems/jets-1.4.5/lib/jets/turbo/rail.rb:14:in `setup'
	15: from /home/josue/.rvm/gems/ruby-2.5.3/gems/jets-1.4.5/lib/jets/turbo/rail.rb:93:in `copy_rack_project'
	14: from /home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:392:in `cp_r'
	13: from /home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:1461:in `fu_each_src_dest'
	12: from /home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:1479:in `fu_each_src_dest0'
	11: from /home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:1463:in `block in fu_each_src_dest'
	10: from /home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:393:in `block in cp_r'
	 9: from /home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:415:in `copy_entry'
	 8: from /home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:1392:in `wrap_traverse'
	 7: from /home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:1392:in `each'
	 6: from /home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:1393:in `block in wrap_traverse'
	 5: from /home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:1392:in `wrap_traverse'
	 4: from /home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:1392:in `each'
	 3: from /home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:1393:in `block in wrap_traverse'
	 2: from /home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:1390:in `wrap_traverse'
	 1: from /home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:418:in `block in copy_entry'
/home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/fileutils.rb:1278:in `copy': cannot handle socket (RuntimeError)

Change S3 Deployment Bucket?

How do I change the S3 deployment bucket from the default? I can't find it anywhere in the config for this...

Bug: Broken production deploy with mega mode

Apparently deploy script is using not defined fulL_cmd variable for compiling rails assets.

https://github.com/tongueroo/jets/blob/9b8dd19b948e0b16494673dd6031ff9cd3a5a10f/lib/jets/builders/code_builder.rb#L224

Traceback (most recent call last):
	22: from /Users/mac/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'
	21: from /Users/mac/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
	20: from /Users/mac/.rvm/gems/ruby-2.5.3/bin/jets:23:in `<main>'
	19: from /Users/mac/.rvm/gems/ruby-2.5.3/bin/jets:23:in `load'
	18: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/jets-1.3.5/exe/jets:14:in `<top (required)>'
	17: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/jets-1.3.5/lib/jets/cli.rb:5:in `start'
	16: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/jets-1.3.5/lib/jets/cli.rb:21:in `start'
	15: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/jets-1.3.5/lib/jets/commands/base.rb:27:in `perform'
	14: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/jets-1.3.5/lib/jets/commands/base.rb:38:in `dispatch'
	13: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
	12: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	11: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	10: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/jets-1.3.5/lib/jets/commands/main.rb:21:in `deploy'
	 9: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/jets-1.3.5/lib/jets/commands/deploy.rb:29:in `run'
	 8: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/jets-1.3.5/lib/jets/commands/deploy.rb:50:in `build_code'
	 7: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/jets-1.3.5/lib/jets/commands/build.rb:26:in `build_code'
	 6: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/jets-1.3.5/lib/jets/builders/code_builder.rb:36:in `build'
	 5: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/jets-1.3.5/lib/jets/builders/code_builder.rb:215:in `compile_rails_assets'
	 4: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/bundler-1.17.2/lib/bundler.rb:313:in `with_clean_env'
	 3: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/bundler-1.17.2/lib/bundler.rb:562:in `with_env'
	 2: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/bundler-1.17.2/lib/bundler.rb:313:in `block in with_clean_env'
	 1: from /Users/mac/.rvm/gems/ruby-2.5.3/gems/jets-1.3.5/lib/jets/builders/code_builder.rb:216:in `block in compile_rails_assets'
/Users/mac/.rvm/gems/ruby-2.5.3/gems/jets-1.3.5/lib/jets/builders/code_builder.rb:224:in `rails_assets': undefined local variable or method `fulL_cmd' for #<Jets::Builders::CodeBuilder:0x00007f9ee1dc8638> (NameError)

Failure to invoke function when deploying from AWS CodeBuild

I'm trying to invoke, through the test feature on the AWS Lambda console, my simple function. If I run the jets deploy from my laptop (Ubuntu 18) then the function invokes fine. If I deploy via CodeBuild (using the aws/codebuild/ruby:2.5.1 docker image) then I got the following error when I invoke it. I've tried to determine what the difference is between the 2 and can't. Do you have any insight as to what might be going wrong?

START RequestId: 9b7e9030-f1ce-11e8-b5b4-83337618b920 Version: $LATEST
2018-11-26T22:57:12.706Z	9b7e9030-f1ce-11e8-b5b4-83337618b920	subprocess output:
2018-11-26T22:57:12.706Z	9b7e9030-f1ce-11e8-b5b4-83337618b920	/var/task/bundled/rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:88:in `block in materialize': Could not find rake-12.3.1 in any of the sources (Bundler::GemNotFound)
	from /var/task/bundled/rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `map!'
	from /var/task/bundled/rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `materialize'
	from /var/task/bundled/rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:170:in `specs'
	from /var/task/bundled/rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:237:in `specs_for'
	from /var/task/bundled/rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:226:in `requested_specs'
	from /var/task/bundled/rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:108:in `block in definition_method'
	from /var/task/bundled/rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:20:in `setup'
	from /var/task/bundled/rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler.rb:107:in `setup'
	from /var/task/bundled/rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/setup.rb:20:in `<top (required)>'
	from /var/task/bundled/rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
	from /var/task/bundled/rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
	from /var/task/bundled/rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'

END RequestId: 9b7e9030-f1ce-11e8-b5b4-83337618b920
REPORT RequestId: 9b7e9030-f1ce-11e8-b5b4-83337618b920	Duration: 120019.06 ms	Billed Duration: 120000 ms 	Memory Size: 1024 MB	Max Memory Used: 51 MB	
2018-11-26T22:59:11.688Z 9b7e9030-f1ce-11e8-b5b4-83337618b920 Task timed out after 120.02 seconds

I've paired my Gemfile down to be as simple as possible:

source "https://rubygems.org"

gem 'jets', '~> 1.1', '>= 1.1.3'

gem 'httparty'


group :development, :test do
    gem 'shotgun'
    gem 'rack'
end

group :test do
    gem 'rspec' # rspec test group only or we get the "irb: warn: can't alias context from irb_context warning" when starting jets console
    gem 'webmock'
end

And my CodeBuild spec is also really simple:

version: 0.2

phases:
  install:
    commands:

    - bundle install

  build:
    commands:
    - JETS_ENV=production jets deploy production

Remove Prewarming for Jobs

Summary

Let's remove prewarming for jobs. No need to prewarm jobs.

Motivation

It removes noise from the CloudWatch logs and makes for a better user experience. This seems like it should be simple to do.

Guide-level explanation

Reference-level explanation

Drawbacks

Time and priorities.

Unresolved Questions

Application name should be inherited from folder name when dot is used

If I create a new project into existing folder:

$ mkdir jets-demo
$ cd jets-demo
$ jets new .

It works otherwise but the: config/application.rb ends up looking like this:

Jets.application.configure do
  config.project_name = "."
  ...
end

And the dot results in name error with AWS when I try to deploy it.

Bug: Missing gems in Mega Mode

Hi, when I add en example project (http://rubyonjets.com/docs/rails-support/) to jets and deploy, I get error messages about missing gem.

I managed to fix it by adding missing gems to the Gemfile in the jets project root.

gem 'nio4r'
gem 'websocket-driver', '0.6.5'
gem 'ffi', '1.9.25'
gem 'puma', '3.12.0'

Here is the example from cloudwatch

11:23:55
๏ฟฝ[0;32;49m=> cd ./rack && bin/rackup๏ฟฝ[0m

11:23:56
/var/runtime/gems/bundler-1.17.1/lib/bundler/spec_set.rb:91:in `block in materialize': Could not find nio4r-2.3.1 in any of the sources (Bundler::GemNotFound)
/var/runtime/gems/bundler-1.17.1/lib/bundler/spec_set.rb:91:in `block in materialize': Could not find nio4r-2.3.1 in any of the sources (Bundler::GemNotFound)
๏„ฟ
11:23:56
from /var/runtime/gems/bundler-1.17.1/lib/bundler/spec_set.rb:85:in `map!'

I'm using the latest version of jets.

jets -v
1.3.5

ruby -v
ruby 2.5.3p105

Ensure Bundler Available on AWS Lambda: Bundle error After deploy

Checklist

  • Upgrade Jets: Are you using the latest version of Jets? This allows Jets to fix issues fast. There's a jets upgrade command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/
  • Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.rubyonjets.com
  • Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

My Environment

Software Version
Operating System MacOS X 10.13.6
Jets 1.5.6
Ruby 2.5.3

Expected Behaviour

After deploy the API should work properly and respond accordingly.

Current Behavior

The lambda function returns the following error:

cannot load such file -- bundler/setup

With the following stacktrace

Init error when loading handler handlers/controllers/api_controller.index
{
  "errorMessage": "cannot load such file -- bundler/setup",
  "errorType": "Init<LoadError>",
  "stackTrace": [
    "/var/lang/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'",
    "/var/lang/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'",
    "/var/task/handlers/controllers/api_controller.rb:1:in `<top (required)>'",
    "/var/lang/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'",
    "/var/lang/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'"
  ]
}
START RequestId: 3e6be219-1bef-40ae-b948-9e8b3831a03b Version: $LATEST

Step-by-step reproduction instructions

Clone the following project, deploy it to AWS Lambda and try to access the /api endpoint.

Code Sample

https://github.com/efreesen/jets-bundler-bug

Solution Suggestion

It seems the app cannot find the bundler gem, I tried to add the bundler into the zip but it didn't work.

The solution I see is to pack the bundler with the other dependencies if this is really the problem.

jets seems to be incompatible with Dynomite

Hello, first of all I want to congratulate you for the wonderful framework you've built. Jets is amazing!

I was playing around with it, running some tests and came with a really strange behaviour.
I was trying to publish a notification to an SNS queue, following the docs and examples and everything went smooth.
Then I decided to add some logic persisting data on a DynamoDB table, using Dynomite and everything started failing.

After digging and running several tests I came to the conclusion that the problem has to do with the following line on dynomite or something related to Aws.config.

I'll try to describe the failing situation:

  • I'm using DYNAMODB_ENDPOINT=https://dynamodb.eu-west-1.amazonaws.com in my .env files
  • I have a Dynomite::Item:
class Channel < ApplicationItem
  partition_key "name"
end
  • I have an Alert.rb similar to the docs one:
class Alert < Jets::Stack
  sns_topic(:delivery_completed, display_name: "cool topic")
end
  • And then a simple controller:
class ChannelsController < ApplicationController
  include Jets::AwsServices
  class_iam_policy("dynamodb", "sns")
  def index
    channels = Channel.scan
    topic_arn = Alert.lookup(:delivery_completed)
    Jets.logger.debug("About to publish to #{topic_arn}")
    sns.publish(topic_arn: topic_arn,  subject: "Test", message: "Just testing")
    render json: channels.to_json
  end
end

Using this scenario I am able to get the channels, but when I try to lookup for the arn I get the following exception:

{
  "stackTrace": [
    "/tmp/bundled/gems/ruby/2.5.0/gems/aws-sdk-core-3.36.0/lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call'",
    "/tmp/bundled/gems/ruby/2.5.0/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:20:in `call'",
    "/tmp/bundled/gems/ruby/2.5.0/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/idempotency_token.rb:17:in `call'",
    "/tmp/bundled/gems/ruby/2.5.0/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/param_converter.rb:24:in `call'",
    "/tmp/bundled/gems/ruby/2.5.0/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/response_paging.rb:10:in `call'",
    "/tmp/bundled/gems/ruby/2.5.0/gems/aws-sdk-core-3.36.0/lib/seahorse/client/plugins/response_target.rb:23:in `call'",
    "/tmp/bundled/gems/ruby/2.5.0/gems/aws-sdk-core-3.36.0/lib/seahorse/client/request.rb:70:in `send_request'",
    "/tmp/bundled/gems/ruby/2.5.0/gems/aws-sdk-sns-1.7.0/lib/aws-sdk-sns/client.rb:1204:in `publish'",
    "/var/task/app/controllers/channels_controller.rb:9:in `inde [TRUNCATED]"
  ]
}

The catchy thing is that if I lookup the arn first and then scan the dynamo model, the first time the function is invoked, it works as expected, the consequent calls fail.

class ChannelsController < ApplicationController
  include Jets::AwsServices
  class_iam_policy("dynamodb", "sns")
  def index
    topic_arn = Alert.lookup(:delivery_completed)
    Jets.logger.debug("About to publish to #{topic_arn}")
    sns.publish(topic_arn: topic_arn,  subject: "Test", message: "Just testing")
    channels = Channel.scan
    render json: channels.to_json
  end
end

I hope the description is clear enough.

RaY

Webpacker can't find application.js in public/packs/manifest.json

Am just doing a first test for rubyonjets and wanted to try porting over a static website from rubyonrails over and see how easy that would be.
So I just

  1. started a new rubyonjets project,
  2. copied over the views into the app/views directory
  3. copied all the assets into app/javascript/packs directory
  4. copied all images into app/javascript/images directory
  5. changed the routes
  6. changed to link_to helpers (the rails helpers weren't working)
  7. started jets server locally
  8. accessed one of the static pages on my browser

Then I just tried testing out the static page and I keep getting this error below:
ActionView::Template::Error: Webpacker can't find application.js in public/packs/manifest.json. Possible causes:

  1. You want to set webpacker.yml value of compile to true for your environment
    unless you are using the webpack -w or the webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker's config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest.

Am using ruby 2.5.1, jets 1.3.6

Deleting database.yml causes failure to boot

My project doesn't use any SQL database, so I removed the mysql2 Gem dependency and the database.yml file. When I run jets server (or deploy), I receive the error message below. I assume this is because some part of activerecord or activesupport is needed, but isn't loaded because of the lack of DB connection. I suspect I can come up with some workaround for this, but any idea what the proper fix might be? Happy to work on a pull request if I have the time, but I don't really know where to start on it.

Boot Error

Something went wrong while loading config.ru
NoMethodError: undefined method `class_attribute' for Jets::Turbine:Class Did you mean? alias_attribute

/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jets-1.1.2/lib/jets/turbine.rb:3:in `<class:Turbine>'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jets-1.1.2/lib/jets/turbine.rb:2:in `<module:Jets>'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jets-1.1.2/lib/jets/turbine.rb:1:in `<top (required)>'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jets-1.1.2/lib/jets/booter.rb:25:in `turbine_initializers'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jets-1.1.2/lib/jets/booter.rb:13:in `boot!'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jets-1.1.2/lib/jets/core.rb:31:in `boot'
config.ru:4:in `block in inner_app'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/builder.rb:55:in `instance_eval'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in `new'
config.ru:1:in `inner_app'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:113:in `eval'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:113:in `inner_app'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:103:in `assemble_app'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:86:in `proceed_as_child'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:31:in `call!'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:18:in `call'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shotgun-0.9.2/lib/shotgun/favicon.rb:12:in `call'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shotgun-0.9.2/lib/shotgun/static.rb:14:in `call'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/urlmap.rb:68:in `block in call'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/urlmap.rb:53:in `each'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/urlmap.rb:53:in `call'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/builder.rb:153:in `call'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/handler/webrick.rb:86:in `service'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/httpserver.rb:140:in `service'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/httpserver.rb:96:in `run'
/home/aharwood/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/server.rb:307:in `block in start_thread'

Application IAM roles ignored?

I have this at the end of the configure block in application.rb:

config.iam_policy = [
  *Jets::Application.default_iam_policy,
  {
    action: ["dynamodb:*"],
    effect: "Allow",
    resource: "arn:aws:dynamodb:#{Jets.aws.region}:#{Jets.aws.account}:table/#{Jets.project_namespace}-*",
  }
]

Yet this seems to have no effect on the IAM policy/roles that actually ends up on AWS. The policy created on AWS seems to be just the default IAM policy.

Am I doing something wrong or is this feature not working as intended?

Image asset folders don't seem to be compiled

I have javascript, css and font assets placed in app/javascript/packs and images in app/javascript/images, both in several nested folders.

The images do not seem to get compiled. I wonder if I am specifying the path wrong somewhere. Where do I instruct webpack to compile the image assets?

application.rb
Jets.application.configure do config.assets.folders = %w[public] # defaults to public config.assets.max_age = 3600 # when to expire assets end

CORS OPTIONS Access-Control-Allow-Methods issues

Checklist

  • [X ] Upgrade Jets: Are you using the latest version of Jets? This allows Jets to fix issues fast. There's a jets upgrade command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/
  • [ X] Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.rubyonjets.com
  • [ X] Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

My Environment

Software Version
Operating System Mac
Jets 1.6.8
Ruby 2.5.3

Expected Behaviour

OPTIONS resources returns Access-Control-Allow-Methods with all supported HTTP Methods for the path.

Current Behavior

When deploying an API Gateway fronted lambda function ALL options resources are configured to return Access-Control-Allow-Methods = 'OPTIONS,GET' even on paths that support other methods.

Step-by-step reproduction instructions

You can do a simple bootstrap of a jets app with the example /posts and then do OPTIONS requests on /posts and /posts/{id}

Code Sample

jets new demo
cd demo
jets generate scaffold Post title:string
vim .env.development # edit with local db settings
jets db:create db:migrate
jets server

curl -i -X OPTIONS http://localhost:8888/posts | grep Access-Control-Allow-Methods
curl -i -X OPTIONS http://localhost:8888/posts/12345 | grep Access-Control-Allow-Methods

UPDATE: I just realized my example above only suggests local server....if you do the commands below you will get the same results.

jets deploy
curl -i -X OPTIONS http://#{deployed_url}/posts | grep Access-Control-Allow-Methods
curl -i -X OPTIONS http://#{deployed_url}/posts/12345 | grep Access-Control-Allow-Methods

Long controller names may break deployment with error "Value 'X' at 'roleName' failed to satisfy constraint: Member must have length less than or equal to 64"

Hey @tongueroo ,
When IAM role is generated, it is using project name + controller name to build IAM role name, but there's a 64 character constraint on it by AWS, so deployment may fail with a message like this:

1 validation error detected: Value 'patchkit-app-catalog-dev-catalogs-apps-screenshots-controller-role' at 'roleName' failed to satisfy constraint: Member must have length less than or equal to 64 (Service: AmazonIdentityManagement; Status Code: 400; Error Code: ValidationError; Request ID: 8924cd64-1be2-11e9-8391-5d4c146a6728)

Checklist

  • Upgrade Jets: Are you using the latest version of Jets? This allows Jets to fix issues fast. There's a jets upgrade command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/
  • Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.rubyonjets.com
  • Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

Code Sample

# I believe this one should reproduce it
class Catalogs::Apps::ScreenshotsWithReallyLongNameController < ApplicationController
end

Solution Suggestion

Either way:

  • allow custom class role names
  • generate a role name if role name is too long

jets new throws error

I follow the installation requirements and perform jets new demo and receive the following error:

.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/aws-sdk-core-3.30.0/lib/aws-sdk-core/plugins/regional_endpoint.rb:42:in `after_initialize': missing region; use :region option or export region name to ENV['AWS_REGION'] (Aws::Errors::MissingRegionError)

Bug: query params are not passed to Rails.

Hi, I really like the new way of using Rails with jets ๐Ÿ‘

I'm trying to pass query params, but they are not available in Rails:

If I use url like dev/posts?exampleparameter=isnotpassed, then I can see that in Jets logs my parameters are present, but in Rails they aren't.

I, [2018-12-24T11:50:08.107337 #10] INFO -- : Started GET "/posts" for 109.252.121.144 at 2018-12-24 11:50:08 +0000
I, [2018-12-24T11:50:08.107396 #10] INFO -- : Processing Jets::RackController#process
I, [2018-12-24T11:50:08.107682 #10] INFO -- : Event: {"resource":"/{catchall+}","path":"/posts","httpMethod":"GET","headers":...
I, [2018-12-24T11:50:08.107798 #10] INFO -- : Parameters: {"exampleparameter":"isnotpassed","catchall":"posts"}
...
Rails: Started GET "/dev/posts" for 205.251.218.73 at 2018-12-24 11:50:08 +0000
Rails: Processing by PostsController#index as HTML
Rails: Here is params.to_unsafe_h in Rails: {"controller"=>"posts", "action"=>"index"}

Multiple Variables Path Issue Error Message

Checklist

  • Upgrade Jets: Are you using the latest version of Jets? This allows Jets to fix issues fast. There's a jets upgrade command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/
  • Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.rubyonjets.com
  • Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

My Environment

Software Version
Operating System Amazon Linux
Jets 1.5.3
Ruby 2.5.3

Expected Behaviour

Deploying Jets application with routes that have different path variables under the same parent route should work.

Current Behavior

Deploying with a config/routes.rb that has:

get 'posts/:id', to: 'posts#show'
post 'post/:post_id/reveal', to: 'posts#show'

Produces this error:

A sibling ({post_id}) of this resource already has a variable path part -- only one is allowed

CloudFormation error screenshot:

cloudformation-error-multiple-variables-path

Step-by-step reproduction instructions

git clone https://github.com/tongueroo/jets-issue-path-variables demo
cd demo
# comment out the multiple route so we can get a full succcessful deploy first
# https://github.com/tongueroo/jets-issue-path-variables/blob/b7be42eb0ad2bd933461f48ab328330dd4674c9e/config/routes.rb#L5
jets deploy
# add back in the route that cause the issue
jets deploy 

Note it is helpful to comment out route that causes the issue and deploy successfully first and then deploy again.

Here's also manual reproduction using the API Gateway Console:

multiple-variables-path-part-issue

Code Sample

https://github.com/tongueroo/jets-issue-path-variables

Solution Suggestion

  1. Add docs noting this API Gateway constraint and how to currently avoid it. That's a big win and will help save folks time right now.
  2. Upon route building, check for โ€œmultiple variable part path definitionsโ€ that collide and error with an informative message to the user. So the user finds out about this early as we can help with the process, locally. Even before they try to deploy. When they deploy check the same logic and also provide same information message in case they deploy without checking locally. Something like

API Gateway only allows one unique variable path. [screenshot link]. You must use the same variable name within the same parent route path. Example: /posts/:id and /posts/:post_id/reveal should both be /posts/:id and /posts/:id/reveal.

Something like that, the message can be improved and can tell the users how to fix it.

References

Original discussion: https://community.rubyonjets.com/t/jets-deploy-create-failed-aws-stack-apigateway-embedded/52

Exception reporting

I'd like to add exception reporting (probably Sentry, possibly Honeybadger) to my Jets app.

What's the best way of getting the reporting to work without having to rescue the exceptions manually?

node_modules - this was created by mistake. ignore

Checklist

  • Upgrade Jets: Are you using the latest version of Jets? This allows Jets to fix issues fast. There's a jets upgrade command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/
  • Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.rubyonjets.com
  • Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

My Environment

Software Version
Operating System
Jets
Ruby

Expected Behaviour

Current Behavior

Step-by-step reproduction instructions

Code Sample

Solution Suggestion

Setting/getting cookies

Hi!

Is it possible to manage cookies from jets? Can't find any mention of cookies or sessions in the code.

By the way, awesome project!

Feature Request: Support AWS Profiles

I might be crazy, but after twenty minutes of googling and doc-diving, I can't find any documentation on how to feed my AWS credentials to jets. It seems like it uses the default creds stored in ~/.aws/credentials, but does not respect AWS_DEFAULT_PROFILE to allow me to, say, deploy my production resources to a different account than my pre-prod resources, which is a really common pattern.

I might just be up late and missing something really obvious, though.

Deploy failure: pg_ext.so shared object file not found

  • Created VPC and Postgresql RDS instance following standard AWS procedure.
  • Verified public accessibility by making connection to DB via pgAdmin and psql
  • Created new jets repo on local machine with jets new demo.
  • Removed mysql2 gem and replaced with pg 0.21; executed bundle install
  • Executed jets g scaffold Post title body published:boolean with success
  • Executed jets db:create db:migrate with success
  • Verified correct functioning of PostsController on localhost:8888 by performing CRUD operations on posts
  • Verified Jets connection to RDS instance by executing JETS_REMOTE_ENV=1 jets db:create db:migrate with success
  • Executed jets deploy with apparent success; received API endpoint.
  • Attempted to visit endpoint, received error message {"message": "Internal server error"}
  • Testing Lambda posts_controller-index function yields:
    { "errorMessage": "libpq.so.5: cannot open shared object file: No such file or directory - /opt/ruby/gems/2.5.0/gems/pg-0.21.0/lib/pg_ext.so", "errorType": "Init<LoadError>", "stackTrace": [ "/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in require'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in block in require'", "/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in load_dependency'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in require'", "/opt/ruby/gems/2.5.0/gems/pg-0.21.0/lib/pg.rb:4:in <top (required)>'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in require'", "/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in block in require'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in load_dependency'", "/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in require'",
    "/opt/ruby/gems/2.5.0/gems/jets-1.3.8/lib/jets/db.rb:9:in <top (required)>'", "/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in require'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in block in require'", "/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in load_dependency'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in require'", "/opt/ruby/gems/2.5.0/gems/jets-1.3.8/lib/jets.rb:70:in <top (required)>'",
    "/var/task/handlers/controllers/posts_controller.rb:2:in require'", "/var/task/handlers/controllers/posts_controller.rb:2:in <top (required)>'",
    "/var/lang/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in require'", "/var/lang/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in require'"
    ]
    }`

I've run through several iterations of this process with identical results over the past couple of days. I attempted a deploy using MySQL and was able to connect to the Jets splash screen at the API endpoint. When I have time I will also try DynamoDB, just to test. But I am much more familiar with Postgres and would really prefer to use it. But I can't seem to make it work, and I'm not smart enough to figure out why.

I'm guessing that something is going wrong with the process of injecting the pg version compiled with AMI native extensions but don't understand that process well enough to test further.

System notes:

  • OS: Pop!OS 18.04
  • version manager: asdf (ruby, node, and postgres)
  • ports: I run postgres 9.6 and 10.4 under asdf locally on port 5555, to avoid conflicts with dev setup from work that binds 5432 to a docker container. I don't think that's causing trouble because by specifying the port I'm able to connect successfully to both the local db on 5555 and the RDS instance on 5432, but offer it just in case.

That's all I can think of that might help. If you give me directions for things to try I'm perfectly willing to test anything. I am excited about the concept, like the implementation, and have a perfect use case for Jets. I want to put it in production, and would already be staging it if not for this hiccup.

Thanks for the tools. If there's anything within my ability, or even within a reasonable stretch, I'd like to contribute at some point.

jets build fails

Running jets build fails for me with the following error message:

Requested resource not found
Error evaluating ERB template on line 7 of: /Users/matt/.rvm/gems/ruby-2.5.1/gems/jets-1.0.4/lib/jets/builders/templates/handler.js
2
3 const shim = require("handlers/shim.js");
4
5 shim.once(); // runs in lambda execution context
6
7 <% @vars.functions.each do |function_name| %>
8 exports.<%= function_name %> = shim.handler("<%= @vars.handler_for(function_name) %>");
9 <% end -%>

package.json not being created on `jets new`

Checklist

  • Upgrade Jets: Are you using the latest version of Jets? This allows Jets to fix issues fast. There's a jets upgrade command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/
  • Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.rubyonjets.com
  • Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

My Environment

Software Version
Operating System osx
Jets latest
Ruby 2.5+

Expected Behaviour

When i run

jets new demo --database=postgresql; cd demo; jets generate scaffold Post title:string body:text published:boolean; jets db:create db:migrate; jets server --port 9977 --host 0.0.0.0

I'd expect a package.json to be created. It is not. This example project has one that's created on the "first commit".

Current Behavior

jets skips the package.json creation.

Creating new project called demo.
      create  demo
      create  demo/.env.development
      create  demo/.env.test
      create  demo/.env
      create  demo/.gitignore
      create  demo/.jetskeep
      create  demo/.rspec
      create  demo/Gemfile
      create  demo/Procfile
      create  demo/README.md
      create  demo/Rakefile
      create  demo/app/controllers/application_controller.rb
      create  demo/app/helpers/application_helper.rb
      create  demo/app/jobs/application_job.rb
      create  demo/app/models/application_item.rb
      create  demo/app/models/application_record.rb
      create  demo/app/views/layouts/application.html.erb
      create  demo/config.ru
      create  demo/config/application.rb
      create  demo/config/database.yml
      create  demo/config/dynamodb.yml
      create  demo/config/environments/development.rb
      create  demo/config/environments/production.rb
      create  demo/config/routes.rb
      create  demo/db/.gitkeep
      create  demo/public/404.html
      create  demo/public/422.html
      create  demo/public/500.html
      create  demo/public/favicon.ico
      create  demo/public/index.html
      create  demo/spec/controllers/posts_controller_spec.rb
      create  demo/spec/fixtures/payloads/posts-index.json
      create  demo/spec/fixtures/payloads/posts-show.json
      create  demo/spec/spec_helper.rb
Fetching https://github.com/tongueroo/webpacker.git
Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...
Using rake 12.3.2
Using concurrent-ruby 1.1.4
Using i18n 1.5.3
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.2
Using builder 3.2.3
Using erubi 1.8.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.1
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.3
Using rails-html-sanitizer 1.0.4
Using actionview 5.2.2
Using rack 2.0.6
Using rack-test 1.1.0
Using actionpack 5.2.2
Using activemodel 5.2.2
Using arel 9.0.0
Using activerecord 5.2.2
Using public_suffix 3.0.3
Using addressable 2.6.0
Using aws-eventstream 1.0.1
Using aws-partitions 1.136.0
Using aws-sigv4 1.0.3
Using jmespath 1.4.0
Using aws-sdk-core 3.46.0
Using aws-sdk-apigateway 1.23.0
Using aws-sdk-cloudformation 1.14.0
Using aws-sdk-cloudwatchlogs 1.13.0
Using aws-sdk-dynamodb 1.20.0
Using aws-sdk-kms 1.13.0
Using aws-sdk-lambda 1.17.0
Using aws-sdk-s3 1.30.1
Using aws-sdk-sns 1.9.0
Using aws-sdk-sqs 1.10.0
Using bundler 2.0.1
Using byebug 10.0.2
Using mini_mime 1.0.1
Using regexp_parser 1.3.0
Using xpath 3.2.0
Using capybara 3.13.2
Using diff-lcs 1.3
Using dotenv 2.6.0
Using dynomite 1.2.2
Using json 2.1.0
Using gems 1.1.1
Using hashie 3.6.0
Using jets-html-sanitizer 1.0.4
Using kramdown 2.1.0
Using memoist 0.16.0
Using mimemagic 0.3.3
Using method_source 0.9.2
Using thor 0.20.3
Using railties 5.2.2
Using rainbow 3.0.0
Using recursive-open-struct 1.1.0
Using text-table 1.2.4
Using jets 1.6.9
Using launchy 2.4.3
Using pg 1.1.4
Using rack-proxy 0.6.5
Using rspec-support 3.8.0
Using rspec-core 3.8.0
Using rspec-expectations 3.8.2
Using rspec-mocks 3.8.0
Using rspec 3.8.0
Using shotgun 0.9.2
Using webpacker 3.2.0 from https://github.com/tongueroo/webpacker.git (at jets@3651cc3)
Bundle complete! 10 Gemfile dependencies, 71 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  jets webpacker:install from "."
      create  config/webpacker.yml
Copying webpack core config
      create  config/webpack
      create  config/webpack/development.js
      create  config/webpack/environment.js
      create  config/webpack/production.js
      create  config/webpack/staging.js
      create  config/webpack/test.js
Copying .postcssrc.yml to app root directory
      create  .postcssrc.yml
Copying .babelrc to app root directory
      create  .babelrc
Installing binstubs
         run  bundle binstubs webpacker from "."
      append  .gitignore
Installing all JavaScript dependencies
         run  yarn add @rails/webpacker [email protected] from "."
yarn add v1.13.0
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
warning " > [email protected]" has unmet peer dependency "webpack@^4.0.0".
warning "webpack-dev-server > [email protected]" has unmet peer dependency "webpack@^4.0.0".
warning "@rails/webpacker > [email protected]" has unmet peer dependency "caniuse-lite@^1.0.30000697".
[4/4] ๐Ÿ”จ  Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
โ””โ”€ @rails/[email protected]
info All dependencies
โ””โ”€ @rails/[email protected]
โœจ  Done in 2.90s.
Installing dev server for live reloading
         run  yarn add --dev webpack-dev-server from "."
yarn add v1.13.0
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
warning "@rails/webpacker > [email protected]" has unmet peer dependency "caniuse-lite@^1.0.30000697".
warning "webpack-dev-server > [email protected]" has unmet peer dependency "webpack@^4.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@^4.0.0".
[4/4] ๐Ÿ”จ  Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
โ””โ”€ [email protected]
info All dependencies
โ””โ”€ [email protected]
โœจ  Done in 2.65s.
Webpacker successfully installed ๐ŸŽ‰ ๐Ÿฐ
      create  app/javascript
      create  app/javascript/packs/application.js
      create  app/javascript/packs/theme.scss
      create  app/javascript/src/jets/crud.js
      insert  config/webpack/environment.js
         run  yarn add [email protected] jquery popper.js from "."
yarn add v1.13.0
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
warning "@rails/webpacker > [email protected]" has unmet peer dependency "caniuse-lite@^1.0.30000697".
warning " > [email protected]" has unmet peer dependency "webpack@^4.0.0".
warning "webpack-dev-server > [email protected]" has unmet peer dependency "webpack@^4.0.0".
[4/4] ๐Ÿ”จ  Building fresh packages...
success Saved 2 new dependencies.
info Direct dependencies
โ”œโ”€ [email protected]
โ””โ”€ [email protected]
info All dependencies
โ”œโ”€ [email protected]
โ””โ”€ [email protected]
โœจ  Done in 2.63s.
         run  git init from "."
Initialized empty Git repository in /Users/timothysabat/Development/visinote/jets_demo/demo/.git/
         run  git add . from "."
         run  git commit -m 'first commit' from "."
[master (root-commit) 2289bc2] first commit
 44 files changed, 1170 insertions(+)
 create mode 100644 .babelrc
 create mode 100644 .gitignore
 create mode 100644 .jetskeep
 create mode 100644 .postcssrc.yml
 create mode 100644 .rspec
 create mode 100644 Gemfile
 create mode 100644 Gemfile.lock
 create mode 100644 Procfile
 create mode 100644 README.md
 create mode 100644 Rakefile
 create mode 100644 app/controllers/application_controller.rb
 create mode 100644 app/helpers/application_helper.rb
 create mode 100644 app/javascript/packs/application.js
 create mode 100644 app/javascript/packs/theme.scss
 create mode 100644 app/javascript/src/jets/crud.js
 create mode 100644 app/jobs/application_job.rb
 create mode 100644 app/models/application_item.rb
 create mode 100644 app/models/application_record.rb
 create mode 100644 app/views/layouts/application.html.erb
 create mode 100755 bin/webpack
 create mode 100755 bin/webpack-dev-server
 create mode 100644 config.ru
 create mode 100644 config/application.rb
 create mode 100644 config/database.yml
 create mode 100644 config/dynamodb.yml
 create mode 100644 config/environments/development.rb
 create mode 100644 config/environments/production.rb
 create mode 100644 config/routes.rb
 create mode 100644 config/webpack/development.js
 create mode 100644 config/webpack/environment.js
 create mode 100644 config/webpack/production.js
 create mode 100644 config/webpack/staging.js
 create mode 100644 config/webpack/test.js
 create mode 100644 config/webpacker.yml
 create mode 100644 db/.gitkeep
 create mode 100644 public/404.html
 create mode 100644 public/422.html
 create mode 100644 public/500.html
 create mode 100644 public/favicon.ico
 create mode 100644 public/index.html
 create mode 100644 spec/controllers/posts_controller_spec.rb
 create mode 100644 spec/fixtures/payloads/posts-index.json
 create mode 100644 spec/fixtures/payloads/posts-show.json
 create mode 100644 spec/spec_helper.rb
================================================================
Congrats ๐ŸŽ‰ You have successfully created a Jets project.

Cd into the project directory:
  cd demo

So, when you run the server, you get an error looking for node_modules/.bin/webapcker

[Webpacker] Compilingโ€ฆ
[Webpacker] Compilation failed:

bundler: failed to load command: webpack (/Users/timothysabat/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bin/webpack)
Errno::ENOENT: No such file or directory - /Users/timothysabat/Development/visinote/jets_demo/demo/node_modules/.bin/webpack
  /Users/timothysabat/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bundler/gems/webpacker-3651cc317358/lib/webpacker/webpack_runner.rb:11:in `exec'
  /Users/timothysabat/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bundler/gems/webpacker-3651cc317358/lib/webpacker/webpack_runner.rb:11:in `block in run'
  /Users/timothysabat/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bundler/gems/webpacker-3651cc317358/lib/webpacker/webpack_runner.rb:10:in `chdir'
  /Users/timothysabat/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bundler/gems/webpacker-3651cc317358/lib/webpacker/webpack_runner.rb:10:in `run'
  /Users/timothysabat/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bundler/gems/webpacker-3651cc317358/lib/webpacker/runner.rb:6:in `run'
  /Users/timothysabat/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bundler/gems/webpacker-3651cc317358/exe/webpack:8:in `<top (required)>'
  /Users/timothysabat/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bin/webpack:23:in `load'
  /Users/timothysabat/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bin/webpack:23:in `<top (required)>'

ActionView::Template::Error: Webpacker can't find application.js in /Users/timothysabat/Development/visinote/jets_demo/demo/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
   unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:

Step-by-step reproduction instructions

Solution Suggestion

Maybe a new version has stopped creating this file?

gem install jets not working without postgresql installed locally

looks like I needed to have postgresql installed locally on my mac (High Sierra 10.13.6 w/Xcode 9.4.1 w/devtools installed) in order to install the jets gem. should probably note this (and other possible dependencies) in the installation docs. I see this note in your gemspec, but having this in the quick start could be helpful until this req is removed :)

https://github.com/tongueroo/jets/blob/master/jets.gemspec#L53

This issue is about http://rubyonjets.com/docs/install/ (source file: https://github.com/tongueroo/jets/blob/master/docs/_docs/install.md)

Jets shouldn't fail silently on rsync calls if rsync doesn't exist.

Commit 1f20a6c replaced some recursive copy functionality with rsync calls. My first attempt at deploying with jets was done from within a debian-based docker container, which doesn't have rsync by default. The rsync command is run with quite: true so when it fails, there is no output, and the deploy fails with a cryptic error:

Traceback (most recent call last):
        12: from /usr/local/bundle/bin/jets:23:in `<main>'
        11: from /usr/local/bundle/bin/jets:23:in `load'
        10: from /usr/local/bundle/gems/jets-1.6.5/exe/jets:14:in `<top (required)>'
         9: from /usr/local/bundle/gems/jets-1.6.5/lib/jets/cli.rb:5:in `start'
         8: from /usr/local/bundle/gems/jets-1.6.5/lib/jets/cli.rb:20:in `start'
         7: from /usr/local/bundle/gems/jets-1.6.5/lib/jets/cli.rb:48:in `boot_jets'
         6: from /usr/local/bundle/gems/jets-1.6.5/lib/jets/core.rb:18:in `boot'
         5: from /usr/local/bundle/gems/jets-1.6.5/lib/jets/booter.rb:7:in `boot!'
         4: from /usr/local/bundle/gems/jets-1.6.5/lib/jets/booter.rb:31:in `turbo_charge'
         3: from /usr/local/bundle/gems/jets-1.6.5/lib/jets/turbo.rb:15:in `charge'
         2: from /usr/local/bundle/gems/jets-1.6.5/lib/jets/turbo/rail.rb:13:in `setup'
         1: from /usr/local/bundle/gems/jets-1.6.5/lib/jets/turbo/rail.rb:44:in `wrapper_jets_project'
/usr/local/bundle/gems/jets-1.6.5/lib/jets/turbo/rail.rb:44:in `write': No such file or directory @ rb_sysopen - /tmp/jets/turbo-wrapper-project/date.txt (Errno::ENOENT)

I think having rsync is a reasonable assumption, but perhaps remove quiet: true from https://github.com/tongueroo/jets/blob/95e7d74bbb7d764693287068c6e9e8ba549d3112/lib/jets/util.rb#L16 so the failure is more obvious.

RE: Abstract Cloud Providers Question

This issue is to answer a great question from @pocheptsov

RE: Unrelated to this issue, so we can start a separate conversation, @tongueroo have you thought about abstracting AWS Lambda implementation, so it could potentially support other cloud providers or even be cross-cloud?

@pocheptsov Yes, have thought about this. Though trying to avoid absolutisms, don't think different Cloud Provider support will be part of Jets any time soon. Here are my thoughts:

Different Cloud providers have different features. The clouds rarely work the same. So the abstraction usually ends up resulting to the lowest common denominator interface design. A somewhat crude analogy are iPhone and Andriod app stores when they first came out. An abstracted app interface would have resulted in the lowest common denominator between the 2 of the phone platforms, at least until there is enough parity between the 2 platforms.

Currently, AWS is ahead in breathe and depth. For example, AWS not only has a more mature Lambda offering but they also have API Gateway. Though Google functions look great, they are still in beta. Unsure if something like API Gateway is on the horizon for Google. So the answer is that Jets will be solely focused on only AWS for a while.

More thoughts on Software Philosophy here: BoltOps Tooling and Software Design Philosophy

Making Lots of Pots

Wanted to add another thought that might be valuable here. Been trying to explicitly focus in on concrete implementations and doing abstractions along the way for Jets, instead of the other way around. This might sound counter-intuitive since a great software abstraction can seriously improve the software. However, the Pottery story explains this well:

A pottery teacher split her class into two halves.

To the first half she said, โ€œYou will spend the semester studying pottery, planning, designing, and creating your perfect pot. At the end of the semester, there will be a competition to see whose pot is the bestโ€.

To the other half she said, โ€œYou will spend your semester making lots of pots. Your grade will be based on the number of completed pots you finish. At the end of the semester, youโ€™ll also have the opportunity to enter your best pot into a competition.โ€

The first half of the class threw themselves into their research, planning, and design. Then they set about creating their one, perfect pot for the competition.

The second half of the class immediately grabbed fistfuls of clay and started churning out pots. They made big ones, small ones, simple ones, and intricate ones. Their muscles ached for weeks as they gained the strength needed to throw so many pots.

At the end of class, both halves were invited to enter their most perfect pot into the competition. Once the votes were counted, all of the best pots came from the students that were tasked with quantity. The practice they gained made them significantly better potters than the planners on a quest for a single, perfect pot.

The pottery story shows a common issue of engineering: Analysis Paralysis. So right now, making pots with Jets.

Reference:

Remove Rails Constant

Summary

In a Jets application, the Rails constant is currently defined. Requesting to remove the Rails constant.

Motivation

The reason it would be good to remove this constant is that other gems, libraries, and plugins check for the Rails constant to infer that it's in a Rails app and perform some Rails specific logic. Having the Rails constant defined in a Jets application results in not being able to use these libraries in Jets applications. Being able to use these libraries would be a huge benefit.

Links:

Guide-level explanation

Remove the Rails constant.

Reference-level explanation

TBD

Drawbacks

Jets uses Rails to do some heavy lifting like rendering. This is one of the reasons why Rails is currently defined. Some of the ActionView code defines it. So it's a decent amount of work, but think it's still worth it though!

Unresolved Questions

Will have to dig into this to figure out the issues and let it simmer on the brain for a bit.

Feature Request: Compiled gems from local machine, without lambdagems

Hi. Do you think it's possible to make jets use precompiled gems from a deploying machine?
For example if we put them into .jets/precompiled_gems/?
In that case we can just precompile them with docker image of amazon linux, can't we?

Btw, could you add more documentation on how to host your own precompiled gems here http://rubyonjets.com/docs/lambdagems/ ? Right now it's not clear in what format and url gems should be available there.

Minimal IAM Policies

Hey!

I'm having trouble configuring permissions for to perform a deploy to AWS. Can you add list of permissions required in the docs?

Thanks!

Deploy failed. No such file or directory

I'm using

  • rbenv, ruby 2.5.3
  • jets 1.3.6
  • bundler 1.17.2
    • global config ใ€ŒBUNDLE_PATH: "vendor/bundle"ใ€

Flow of reproduction

  1. created Gemfile ใ€Œgem "jets"ใ€in empty folder. And bundle install
  2. created skeleton jets project. bundle exec jets new v1 --mode api
  3. cd v1
  4. bundle exec jets deploy
Tidying project: removing ignored files to reduce package size.
bundler: failed to load command: jets (/Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/bin/jets)
Errno::ENOENT: No such file or directory @ rb_file_s_rename - (/tmp/jets/v1/stage/code/vendor/bundle/ruby/2.5.0, /tmp/jets/v1/stage/opt/ruby/gems/2.5.0)
  /Users/user/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:471:in `rename'
  /Users/user/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:471:in `block in mv'
  /Users/user/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1463:in `block in fu_each_src_dest'
  /Users/user/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1479:in `fu_each_src_dest0'
  /Users/user/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1461:in `fu_each_src_dest'
  /Users/user/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:460:in `mv'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/builders/lambda_layer.rb:34:in `move_vendor_to_opt'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/builders/lambda_layer.rb:18:in `build'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/builders/code_builder.rb:114:in `build_lambda_layer'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/builders/code_builder.rb:104:in `code_finish'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/builders/code_builder.rb:42:in `block in build'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/builders/code_builder.rb:38:in `chdir'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/builders/code_builder.rb:38:in `build'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/commands/build.rb:26:in `build_code'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/commands/deploy.rb:50:in `build_code'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/commands/deploy.rb:29:in `run'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/commands/main.rb:21:in `deploy'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/commands/base.rb:38:in `dispatch'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/commands/base.rb:27:in `perform'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/cli.rb:21:in `start'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/lib/jets/cli.rb:5:in `start'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/gems/jets-1.3.6/exe/jets:14:in `<top (required)>'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/bin/jets:23:in `load'
  /Users/user/Desktop/project/api/vendor/bundle/ruby/2.5.0/bin/jets:23:in `<top (required)>'

When I comment out 'tidy' function, deploy succeed.

https://github.com/tongueroo/jets/blob/master/lib/jets/builders/ruby_packager.rb#L31

Support rendering XML

Checklist

  • Upgrade Jets: Are you using the latest version of Jets? This allows Jets to fix issues fast. There's a jets upgrade command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/
  • Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.rubyonjets.com
  • Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

My Environment

Software Version
Operating System MacOS 10.14.3
Jets 1.6.4
Ruby 2.5.3

Expected Behaviour

When rendering as xml I would expect Jets to set a Content-Type header set to application/xml.

Current Behavior

When you render a string as xml from a controller the Content-Type is set to text/html`

Step-by-step reproduction instructions

Create a Jets application and a controller. Create an action that renders the result as xml:

class MessagesController > ApplicationController
  def create
    render xml: "<Hello>World</Hello>"
  end
end

Create a route for the action. Run the application and visit the route. The response header is text/html.

I am raising this as a bug as the content is rendered when it is passed via render xml: content but it's not served correctly.

Solution Suggestion

This is something that Rails handles, so I'm surprised it didn't work in Jets as the rendering is handed off to ActionController::Base. I tried to follow the render path, which lead me to setting up the render options which shows that the xml key is handled. But I couldn't find where it went from there and where the response headers were set.

Workaround

You can work around this for now by manually setting the content type:

    render xml: "<Hello>World</Hello>", content_type: "application/xml"

Mega mode does not start rack app on port 9292 automatically

I followed the instructions for Mega Mode from https://blog.boltops.com/2018/11/03/jets-mega-mode-run-rails-on-aws-lambda
I created a new project, and then linked my rails project, watched jets pull the rails project into the rack folder.
I tested the rack app using bundle exec rackup from the rack folder and see my rails app being run on port 9292.
When I run jets server, I see the webrick server on port 8888 come up, but the error below indicates the rack app at 9292 isn't started. If I start it manually, then jets server manages to connect to 9292 but then it takes a terribly long time to serve assets. God knows why.
Seems like there is a configuration step missing from the docs.

be jets server
=> bundle exec shotgun --port 8888 --host 127.0.0.1
Jets booting up in development mode!
=> cd ./rack && bin/rackup --host 127.0.0.1
sh: bin/rackup: No such file or directory
== Shotgun/WEBrick on http://127.0.0.1:8888/
== Shotgun/WEBrick on http://127.0.0.1:8888/
[2018-12-23 10:46:16] INFO  WEBrick 1.4.2
[2018-12-23 10:46:16] INFO  WEBrick 1.4.2
[2018-12-23 10:46:16] INFO  ruby 2.5.1 (2018-03-29) [x86_64-darwin14]
[2018-12-23 10:46:16] INFO  ruby 2.5.1 (2018-03-29) [x86_64-darwin14]
bundler: failed to load command: shotgun (/Users/rrr/.rbenv/versions/2.5.1/bin/shotgun)
Errno::EADDRINUSE: Address already in use - bind(2) for 127.0.0.1:8888
  /Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/socket.rb:201:in `bind'
  /Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/socket.rb:201:in `listen'
  /Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/socket.rb:764:in `block in tcp_server_sockets'
  /Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/socket.rb:227:in `each'
  /Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/socket.rb:227:in `foreach'
  /Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/socket.rb:762:in `tcp_server_sockets'
  /Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/utils.rb:65:in `create_listeners'
  /Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/server.rb:127:in `listen'
  /Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/server.rb:108:in `initialize'
  /Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/httpserver.rb:47:in `initialize'
  /Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/handler/webrick.rb:31:in `new'
  /Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/handler/webrick.rb:31:in `run'
  /Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shotgun-0.9.2/bin/shotgun:156:in `<top (required)>'
  /Users/rrr/.rbenv/versions/2.5.1/bin/shotgun:23:in `load'
  /Users/rrr/.rbenv/versions/2.5.1/bin/shotgun:23:in `<top (required)>'
[2018-12-23 10:46:16] INFO  WEBrick::HTTPServer#start: pid=4901 port=8888
I, [2018-12-23T10:46:29.214519 #4908]  INFO -- : Started GET "/" for  at 2018-12-23 10:46:29 +0800
I, [2018-12-23T10:46:29.214698 #4908]  INFO -- : Processing Jets::RackController#process
I, [2018-12-23T10:46:29.215200 #4908]  INFO -- :   Event: {"resource":"/{catchall+}","path":"/","httpMethod":"GET","headers":{"Host":"localhost:8888","Connection":"keep-alive","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-GB,en-US;q=0.9,en;q=0.8","Version":"HTTP/1.1","cache-control":"max-age=0","upgrade-insecure-requests":"1"},"queryStringParameters":{},"pathParameters":{"catchall":""},"stageVariables":null,"requestContext":{},"body":null,"isBase64Encoded":false}
I, [2018-12-23T10:46:29.215437 #4908]  INFO -- :   Parameters: {"catchall":""}
Errno::ECONNREFUSED: Failed to open TCP connection to localhost:9292 (Connection refused - connect(2) for "localhost" port 9292)
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:939:in `rescue in block in connect'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:936:in `block in connect'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/timeout.rb:93:in `block in timeout'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/timeout.rb:103:in `timeout'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:935:in `connect'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:920:in `do_start'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:909:in `start'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:1455:in `request'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jets-1.4.2/lib/jets/mega/request.rb:47:in `proxy'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jets-1.4.2/lib/jets/internal/app/controllers/jets/rack_controller.rb:23:in `mega_request'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jets-1.4.2/lib/jets/internal/app/controllers/jets/rack_controller.rb:7:in `process'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jets-1.4.2/lib/jets/controller/base.rb:41:in `dispatch!'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jets-1.4.2/lib/jets/controller/middleware/local.rb:34:in `call'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/method_override.rb:22:in `call'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/runtime.rb:22:in `call'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jets-1.4.2/lib/jets/middleware.rb:12:in `call'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/lint.rb:49:in `_call'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/lint.rb:37:in `call'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/show_exceptions.rb:23:in `call'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/common_logger.rb:33:in `call'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:86:in `proceed_as_child'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:31:in `call!'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:18:in `call'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shotgun-0.9.2/lib/shotgun/favicon.rb:12:in `call'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/shotgun-0.9.2/lib/shotgun/static.rb:14:in `call'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/urlmap.rb:68:in `block in call'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/urlmap.rb:53:in `each'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/urlmap.rb:53:in `call'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/builder.rb:153:in `call'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rack-2.0.6/lib/rack/handler/webrick.rb:86:in `service'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/httpserver.rb:140:in `service'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/httpserver.rb:96:in `run'
	/Users/rrr/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/server.rb:307:in `block in start_thread'
127.0.0.1 - - [23/Dec/2018:10:46:29 +0800] "Get / HTTP/1.1" 500 97168 0.0863

Question: Megamodes 250mb limit?

Jets looks very nice. You're making a great job!

I've just tried to deploy (development) a quite simple rails app and hit 250mb limit. But the doc states that there is 512 MB limit for a rails app.

=> Replacing compiled gems with AWS Lambda Linux compiled versions.
Checking projects gems for pre-built Lambda gems...
Gem nokogiri-1.9.1 unpacked at /tmp/jets/jets5app/stage/code
Gem pg-1.1.3 unpacked at /tmp/jets/jets5app/stage/code
=> rsync -a --links /tmp/jets/jets5app/stage/code/opt/ruby/gems/2.5.0/ /tmp/jets/jets5app/stage/code/vendor/gems/ruby/2.5.0/
Tidying project: removing ignored files to reduce package size.
Over the Lambda size limit of 250MB
Please reduce the size of your code.
Sizes:
Code: 71.2MB - /tmp/jets/jets5app/stage/code
Gem Layer: 218.9MB - /tmp/jets/jets5app/stage/opt
Total Package: 290.2MB
Over limit by: 40.2MB
rvm, 2.5.3
jets 1.3.9

I had 30mb bootsnap cache in rack/tmp folder. So after I removed it I was able to deploy it, but it looks like there is barely enough space for an empty rails application. Not sure that a real production project will fit in that limit.

Is there a workaround for this issue, that I can use?

Jets Deploy Afterburner Mode Errors for Rails API Mode apps

Checklist

  • Upgrade Jets: Are you using the latest version of Jets? This allows Jets to fix issues fast. There's a jets upgrade command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/
  • Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.rubyonjets.com
  • Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

My Environment

Software Version
Operating System Amazon Linux AMI 2018.03
Jets 1.5.2
Ruby 2.5.3

Expected Behaviour

Jets Afterburner deploys a Rails application that is in Rails API Mode successfully.

Current Behavior

The deploy is erroring.

Step-by-step reproduction instructions

git clone https://github.com/tongueroo/demo-rails-api
mkdir -p .jets/app
vim .jets/app/.env # add DATABASE_URL
jets deploy

Stack trace:

Bundle complete! 84 Gemfile dependencies, 228 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
=> cd /tmp/jets/turbo-wrapper-project/rack && bundle exec rake assets:clobber --trace
rake aborted!
Don't know how to build task 'assets:clobber' (See the list of available tasks with `rake --tasks`)
/home/josue/.rvm/gems/ruby-2.5.3/gems/rake-12.3.2/lib/rake/task_manager.rb:59:in `[]'
/home/josue/.rvm/gems/ruby-2.5.3/gems/rake-12.3.2/lib/rake/application.rb:159:in `invoke_task'
/home/josue/.rvm/gems/ruby-2.5.3/gems/rake-12.3.2/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/home/josue/.rvm/gems/ruby-2.5.3/gems/rake-12.3.2/lib/rake/application.rb:116:in `each'
/home/josue/.rvm/gems/ruby-2.5.3/gems/rake-12.3.2/lib/rake/application.rb:116:in `block in top_level'
/home/josue/.rvm/gems/ruby-2.5.3/gems/rake-12.3.2/lib/rake/application.rb:125:in `run_with_threads'
/home/josue/.rvm/gems/ruby-2.5.3/gems/rake-12.3.2/lib/rake/application.rb:110:in `top_level'
/home/josue/.rvm/gems/ruby-2.5.3/gems/rake-12.3.2/lib/rake/application.rb:83:in `block in run'
/home/josue/.rvm/gems/ruby-2.5.3/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
/home/josue/.rvm/gems/ruby-2.5.3/gems/rake-12.3.2/lib/rake/application.rb:80:in `run'
/home/josue/.rvm/gems/ruby-2.5.3/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/home/josue/.rvm/gems/ruby-2.5.3/bin/rake:23:in `load'
/home/josue/.rvm/gems/ruby-2.5.3/bin/rake:23:in `<top (required)>'
/home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:74:in `load'
/home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:74:in `kernel_load'
/home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:28:in `run'
/home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:463:in `exec'
/home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:27:in `dispatch'
/home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:18:in `start'
/home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/exe/bundle:30:in `block in <top (required)>'
/home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/home/josue/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/exe/bundle:22:in `<top (required)>'
/home/josue/.rvm/gems/ruby-2.5.3/bin/bundle:23:in `load'
/home/josue/.rvm/gems/ruby-2.5.3/bin/bundle:23:in `<main>'
cd /tmp/jets/turbo-wrapper-project/rack && bundle exec rake assets:clobber --trace failed to run.
/home/josue/.rvm/gems/ruby-2.5.3/gems/jets-1.5.1/lib/jets/builders/code_builder.rb:231:in `rails_assets'

Code Sample

https://github.com/tongueroo/demo-rails-api

Reference: https://community.rubyonjets.com/t/error-while-deploying-rails-api-mode/47

Deploy hooks

Summary

Would be nice if there was a way to add a hook to .jets/deploy/hooks.rb (for Rails mode) or similar and get the executed after the project was copied to /tmp/jets/turbo-wrapper-project

Motivation

This is the easiest way to allow users customise the deploy process. If some files should be removed from public directory or Gemfile needs to be modified before the deploy. (In my case gems take too much space, but some of them can be removed, since they are not going to be used in Lambda)

Guide-level explanation

  • User can add ruby code in .jets/deploy/hook.rb that gets executed after the project is copied to tmp directory, but before the rest of deploy happens.

Reference-level explanation

TBD

Drawbacks

This feature will be rarely used.

Unresolved Questions

TBD


@tongueroo I can implement this if you support the idea.

๐ŸŽ‰ emoji in default index.html causes enconding problem with default installation

I get this error while starting the default project.

$ jets new project
$ cd project
$ jets version
1.0.9
$ jets server
127.0.0.1 - - [05/Nov/2018:17:36:34 +0000] "GET / HTTP/1.1" 500 183736 0.7434
^[[AI, [2018-11-05T17:38:33.230710 #578]  INFO -- : Processing by Jets::PublicController#show
I, [2018-11-05T17:38:33.232358 #578]  INFO -- :   Event: {"resource"=>"/", "path"=>"/", "httpMethod"=>"GET", "headers"=>{"Host"=>"localhost:8888", "User-Agent"=>"curl/7.52.1", "Accept"=>"*/*", "Version"=>"HTTP/1.1"}, "queryStringParameters"=>{}, "pathParameters"=>nil, "stageVariables"=>nil, "requestContext"=>{}, "body"=>nil, "isBase64Encoded"=>false}
I, [2018-11-05T17:38:33.232478 #578]  INFO -- :   Parameters: {}
ActionView::Template::Error: Your template was not saved as valid US-ASCII. Please either specify US-ASCII as the encoding for your template in your text editor, or mark the template with its encoding by inserting the following as the first line of the template:

# encoding: <name of correct encoding>.

The source of your template was:

<!DOCTYPE html>
<html>
<body>
  <div class="container">
    <header class="header">
      <img src="https://s3.amazonaws.com/jets-public/jets/images/jets.png" class="logo" alt="logo" />
      <h1 class="title">Welcome and congrats ๐ŸŽ‰<br /> Jets is running.</h1>
    </header>
    <div class="intro">
      <p>
        To get started:
      </p>
      <div class="code"><pre><code>
        $ jets generate scaffold Post title:string
        $ jets db:create db:migrate
        $ jets server
        $ open http://localhost:8888/posts
        $ jets help
      </code></pre></div>
      <p>More on info: <a href="http://rubyonjets.com">rubyonjets.com</a></p>
      <p>Also check out the <a href="http://rubyonjets.com/reference">Jets CLI reference</a>.</p>
    </div>
    <p class="version">
      <strong>Jets version:</strong> 1.0.9<br />
      <strong>Ruby version:</strong> 2.5.0
    </p>
  </div>
</body>
</html>

	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/template.rb:232:in `encode!'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/template.rb:282:in `compile'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/template.rb:259:in `block (2 levels) in compile!'
	/usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/notifications.rb:170:in `instrument'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/template.rb:350:in `instrument'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/template.rb:258:in `block in compile!'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/template.rb:246:in `synchronize'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/template.rb:246:in `compile!'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/template.rb:158:in `block in render'
	/usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/notifications.rb:170:in `instrument'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/template.rb:354:in `instrument_render_template'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/template.rb:157:in `render'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/renderer/abstract_renderer.rb:44:in `block in instrument'
	/usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
	/usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
	/usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `instrument'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/renderer/abstract_renderer.rb:43:in `instrument'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/renderer/template_renderer.rb:52:in `render_template'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/renderer/template_renderer.rb:16:in `render'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/renderer/renderer.rb:44:in `render_template'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/renderer/renderer.rb:25:in `render'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/rendering.rb:103:in `_render_template'
	/usr/local/bundle/gems/actionpack-5.2.1/lib/action_controller/metal/streaming.rb:219:in `_render_template'
	/usr/local/bundle/gems/actionview-5.2.1/lib/action_view/rendering.rb:84:in `render_to_body'
	/usr/local/bundle/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:52:in `render_to_body'
	/usr/local/bundle/gems/actionpack-5.2.1/lib/action_controller/metal/renderers.rb:142:in `render_to_body'
	/usr/local/bundle/gems/actionpack-5.2.1/lib/abstract_controller/rendering.rb:46:in `render_to_string'
	/usr/local/bundle/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:41:in `render_to_string'
	/usr/local/bundle/gems/actionpack-5.2.1/lib/action_controller/renderer.rb:83:in `render'
	/usr/local/bundle/gems/jets-1.0.9/lib/jets/controller/renderers/template_renderer.rb:16:in `render'
	/usr/local/bundle/gems/jets-1.0.9/lib/jets/controller/rendering.rb:30:in `render'
	/usr/local/bundle/gems/jets-1.0.9/lib/jets/internal/app/controllers/jets/public_controller.rb:25:in `show'
	/usr/local/bundle/gems/jets-1.0.9/lib/jets/controller/base.rb:24:in `process'
	/usr/local/bundle/gems/jets-1.0.9/lib/jets/poly_fun.rb:25:in `run'
	/usr/local/bundle/gems/jets-1.0.9/lib/jets/server/lambda_aws_proxy.rb:23:in `response'
	/usr/local/bundle/gems/jets-1.0.9/lib/jets/server/api_gateway.rb:10:in `call'
	/usr/local/bundle/gems/jets-1.0.9/lib/jets/server.rb:14:in `call'
	/usr/local/bundle/bundler/gems/webpacker-a8c46614c675/lib/webpacker/dev_server_proxy.rb:18:in `perform_request'
	/usr/local/bundle/gems/rack-proxy-0.6.5/lib/rack/proxy.rb:57:in `call'
	/usr/local/bundle/gems/jets-1.0.9/lib/jets/server/timing_middleware.rb:12:in `call'
	/usr/local/bundle/gems/rack-2.0.5/lib/rack/urlmap.rb:68:in `block in call'
	/usr/local/bundle/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `each'
	/usr/local/bundle/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `call'
	/usr/local/bundle/gems/rack-2.0.5/lib/rack/builder.rb:153:in `call'
	/usr/local/bundle/gems/jets-1.0.9/lib/jets/application/middleware.rb:11:in `call'
	/usr/local/bundle/gems/rack-2.0.5/lib/rack/lint.rb:49:in `_call'
	/usr/local/bundle/gems/rack-2.0.5/lib/rack/lint.rb:37:in `call'
	/usr/local/bundle/gems/rack-2.0.5/lib/rack/show_exceptions.rb:23:in `call'
	/usr/local/bundle/gems/rack-2.0.5/lib/rack/common_logger.rb:33:in `call'
	/usr/local/bundle/gems/shotgun-0.9.2/lib/shotgun/loader.rb:86:in `proceed_as_child'
	/usr/local/bundle/gems/shotgun-0.9.2/lib/shotgun/loader.rb:31:in `call!'
	/usr/local/bundle/gems/shotgun-0.9.2/lib/shotgun/loader.rb:18:in `call'
	/usr/local/bundle/gems/shotgun-0.9.2/lib/shotgun/favicon.rb:12:in `call'
	/usr/local/bundle/gems/shotgun-0.9.2/lib/shotgun/static.rb:14:in `call'
	/usr/local/bundle/gems/rack-2.0.5/lib/rack/urlmap.rb:68:in `block in call'
	/usr/local/bundle/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `each'
	/usr/local/bundle/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `call'
	/usr/local/bundle/gems/rack-2.0.5/lib/rack/builder.rb:153:in `call'
	/usr/local/bundle/gems/rack-2.0.5/lib/rack/handler/webrick.rb:86:in `service'
	/usr/local/lib/ruby/2.5.0/webrick/httpserver.rb:140:in `service'
	/usr/local/lib/ruby/2.5.0/webrick/httpserver.rb:96:in `run'
	/usr/local/lib/ruby/2.5.0/webrick/server.rb:307:in `block in start_thread'

After I remove the emoji from the content it works correctly.

Improve Route Change Detection: Path Variables

Checklist

  • Upgrade Jets: Are you using the latest version of Jets? This allows Jets to fix issues fast. There's a jets upgrade command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/
  • Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.rubyonjets.com
  • Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

My Environment

Software Version
Operating System Amazon Linux
Jets 1.5.3
Ruby 2.5.3

Expected Behaviour

Should be able to change config/routes.rb from:

get  "posts/:id", to: "posts#show"

to

get  "posts/:post_id", to: "posts#show"

And deploy successfully.

Current Behavior

When we deploy the CloudFormation stack rolls back because API Gateway fails to create the new route.

cloudformation-error-multiple-variables-path

Step-by-step reproduction instructions

git clone https://github.com/tongueroo/jets-issue-path-variables demo
cd demo
# comment out the multiple route so we can get a full succcessful deploy first
# https://github.com/tongueroo/jets-issue-path-variables/blob/b7be42eb0ad2bd933461f48ab328330dd4674c9e/config/routes.rb#L5
jets deploy
# change the route to get  "posts/:post_id", to: "posts#show"
jets deploy 

Here's a manual reproduction also:

multiple-variables-path-part-issue

Code Sample

https://github.com/tongueroo/jets-issue-path-variables

Solution Suggestion

The route change detection code should account for this case. Relevant code area: https://github.com/tongueroo/jets/blob/master/lib/jets/resource/api_gateway/rest_api/routes.rb#L10

References

Original discussion: https://community.rubyonjets.com/t/jets-deploy-create-failed-aws-stack-apigateway-embedded/52

Can't start local Jets server without AWS credentials

I don't usually have AWS access keys exposed as env or in ~/.aws/credentials file in my default working environment and I doubt that many do.

I think the default Jets configuration should allow people to run local jets environment for testing locally without any dependency to AWS.

For example this is my Developer experience when I start using the Jets:

$ env
RUBYGEMS_VERSION=2.7.8
BUNDLER_VERSION=1.17.1
HOSTNAME=dcd54d225d69
OLDPWD=/app
RUBY_VERSION=2.5.3
GEM_HOME=/usr/local/bundle
PWD=/app/project
HOME=/root
BUNDLE_PATH=/usr/local/bundle
BUNDLE_APP_CONFIG=/usr/local/bundle
TERM=xterm
BUNDLE_SILENCE_ROOT_WARNING=1
RUBY_MAJOR=2.5
SHLVL=1
RUBY_DOWNLOAD_SHA256=1cc9d0359a8ea35fc6111ec830d12e60168f3b9b305a3c2578357d360fcf306f
PATH=/usr/local/bundle/bin:/usr/local/bundle/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/usr/bin/env
$ jets server
sh: 1: aws: not found
You can also get rid of this message by setting AWS_REGION or configuring ~/.aws/config with the region
Traceback (most recent call last):
	60: from /usr/local/bundle/bin/jets:23:in `<main>'
	59: from /usr/local/bundle/bin/jets:23:in `load'
	58: from /usr/local/bundle/gems/jets-1.0.9/exe/jets:14:in `<top (required)>'
	57: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/cli.rb:5:in `start'
	56: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/cli.rb:18:in `start'
	55: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/cli.rb:101:in `full_command'
	54: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/commands/base.rb:145:in `autocomplete'
	53: from /usr/local/bundle/gems/memoist-0.16.0/lib/memoist.rb:170:in `eager_load!'
	52: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/commands/base.rb:59:in `eager_load!'
	51: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/commands/base.rb:59:in `select'
	50: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/commands/base.rb:70:in `block in eager_load!'
	49: from /usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/core_ext/string/inflections.rb:68:in `constantize'
	48: from /usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:281:in `constantize'
	47: from /usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:281:in `inject'
	46: from /usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:281:in `each'
	45: from /usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:285:in `block in constantize'
	44: from /usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/inflector/methods.rb:285:in `const_get'
	43: from /usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
	42: from /usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
	41: from /usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
	40: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	39: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	38: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/commands/deploy.rb:1:in `<top (required)>'
	37: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/commands/deploy.rb:2:in `<module:Commands>'
	36: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/commands/deploy.rb:5:in `<class:Deploy>'
	35: from /usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
	34: from /usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
	33: from /usr/local/bundle/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
	32: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	31: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	30: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/timing.rb:13:in `<top (required)>'
	29: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/timing.rb:14:in `<module:Jets>'
	28: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/timing.rb:17:in `<module:Timing>'
	27: from /usr/local/bundle/gems/memoist-0.16.0/lib/memoist.rb:170:in `build_root'
	26: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/core.rb:53:in `build_root'
	25: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/core.rb:22:in `config'
	24: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/core.rb:15:in `application'
	23: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/application.rb:14:in `setup!'
	22: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/application.rb:81:in `load_configs'
	21: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/application.rb:121:in `set_aliases!'
	20: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/application.rb:125:in `set_iam_policy'
	19: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/application.rb:143:in `default_iam_policy'
	18: from /usr/local/bundle/gems/memoist-0.16.0/lib/memoist.rb:170:in `account'
	17: from /usr/local/bundle/gems/jets-1.0.9/lib/jets/aws_info.rb:51:in `account'
	16: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/aws-sdk-sts/client.rb:1142:in `get_caller_identity'
	15: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/seahorse/client/request.rb:70:in `send_request'
	14: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/seahorse/client/plugins/response_target.rb:23:in `call'
	13: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/response_paging.rb:10:in `call'
	12: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/param_converter.rb:24:in `call'
	11: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/idempotency_token.rb:17:in `call'
	10: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:20:in `call'
	 9: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/seahorse/client/plugins/raise_response_errors.rb:14:in `call'
	 8: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/param_validator.rb:24:in `call'
	 7: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/seahorse/client/plugins/endpoint.rb:45:in `call'
	 6: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/user_agent.rb:13:in `call'
	 5: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/query/handler.rb:28:in `call'
	 4: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/retry_errors.rb:150:in `call'
	 3: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/helpful_socket_errors.rb:10:in `call'
	 2: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/signature_v4.rb:65:in `call'
	 1: from /usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/signature_v4.rb:112:in `apply_signature'
/usr/local/bundle/gems/aws-sdk-core-3.36.0/lib/aws-sdk-core/plugins/signature_v4.rb:72:in `sign_request': unable to sign request without credentials set (Aws::Errors::MissingCredentialsError)

I noticed the Jets::AwsInfo#test? function and decided to run my local setup with TEST=true.

And immediately Jets started working as I was expecting:

$ export TEST=true
$ jets server
=> bundle exec shotgun --port 8888 --host 127.0.0.1
Jets booting up in development mode!
Jets::Rack#start
== Shotgun/WEBrick on http://127.0.0.1:8888/
[2018-11-05 18:04:32] INFO  WEBrick 1.4.2
[2018-11-05 18:04:32] INFO  ruby 2.5.3 (2018-10-18) [x86_64-linux]
[2018-11-05 18:04:32] INFO  WEBrick::HTTPServer#start: pid=474 port=8888

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.