rubyonjets / jets

Ruby on Jets
http://rubyonjets.com
MIT License
2.6k stars 181 forks source link

omitting public folder from routes results in deployment failure #608

Closed sam0x17 closed 1 year ago

sam0x17 commented 3 years ago

Checklist

My Environment

Software Version
Operating System Windows 11 / WSL 2 / Ubuntu 20.04
Jets 3.0.22
Ruby ruby 2.7.2p137

Expected Behaviour

It should be possible to deploy a jets app without the catchall public logic at the end of routes file

Current Behavior

Deploying an API-only jets app without the any "*catchall", to: "jets/public#show" line at the end results in a deployment failure:

ERROR: Template format error: Unresolved resource dependencies [GemLayer] in the Resources block of the template

Step-by-step reproduction instructions

  1. make a blank jets app with mode set to API
  2. deploy the blank app
  3. remove any "*catchall", to: "jets/public#show" from routes.rb
  4. try to deploy again

Code Sample

above

Solution Suggestion

My hunch is that if the jets/public controller isn't mentioned in routes.rb, the bucket that holds the gem layer gets misconfigured in some way

tongueroo commented 2 years ago

Generated CloudFormation templates deployed with at least one route:

$ ls /tmp/jets/demo/templates/
demo-dev-api-deployment.yml  demo-dev-api-resources-1.yml       demo-dev-app-jets-public_controller.yml  demo-dev.yml
demo-dev-api-gateway.yml     demo-dev-app-jets-preheat_job.yml  demo-dev-app-posts_controller.yml
$ ls /tmp/jets/demo/templates/demo-dev-api-gateway.yml
/tmp/jets/demo/templates/demo-dev-api-gateway.yml
$

The key one is demo-dev-api-gateway.yml

When deployed with no routes. IE:

Jets.application.routes.draw do
end

The generated CloudFormation templates look like this:

$ ls /tmp/jets/demo/templates/
demo-dev-app-jets-preheat_job.yml  demo-dev-app-posts_controller.yml  demo-dev.yml
$

Notice how there's no demo-dev-api-gateway.yml

Also tried without a posts_controller.rb

Generated CloudFormation templates:

$ ls /tmp/jets/demo/templates/
demo-dev.yml
$

Unsure 🧐 Wondering if you can check out the /tmp/jets/APP/templates/ folder when you get a chance. Zip those files up.

tongueroo commented 1 year ago

Took another look at this. Couldn't reproduce. Guessing/hoping that somewhere between Jets 3.0.22 and 3.2.2, this was fixed. And we can deploy an API app without a public folder. Closing out. Feel free to comment to help re-open if needed. Appreciate the detailed report. Thanks!