jets icon indicating copy to clipboard operation
jets copied to clipboard

omitting public folder from routes results in deployment failure

Open sam0x17 opened this issue 2 years ago • 1 comments

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 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

sam0x17 avatar Nov 11 '21 07:11 sam0x17

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 avatar Jan 07 '22 19:01 tongueroo

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!

tongueroo avatar May 25 '23 17:05 tongueroo