Why do I get "Thin adapter not found"?
Asked Answered
N

1

10

I'm an iOS developer with very little Ruby experience, trying to follow "Getting Started with iOS Mobile Development and a Sinatra API" on getting an API running on Heroku.

I grabbed the sample project on Git, so I know I have an identical setup to what I'm supposed to have.

I've bundle installed, and thought that everything should be ready to go, but whenever I do a foreman start I get this:

2:14:56 web.1     | started with pid 5140
12:14:57 web.1     | No adapter found for {MY PROJECT'S FILEPATH}
12:14:57 web.1     | process terminated
12:14:57 system    | sending SIGTERM to all processes

What am I doing wrong, or what do I need to do to get this to run?

Thanks!

Northbound answered 11/2, 2012 at 17:24 Comment(0)
C
17

You are missing a config.ru file that is required to know how to start the application.

Create a file in your root called config.ru and add the following to it:

require './api'
run Sinatra::Application

You can test this is correct by running rackup in the project root. If the config file is correct then your server should start.

Please read When to use config.ru and http://devcenter.heroku.com/articles/rack for further information.

Cobbett answered 11/2, 2012 at 17:41 Comment(2)
I had to capitalize the A in Sinatra::Application, but then it worked. Thanks, and thanks for the links!Northbound
This is a good answer, but the original post from Heroku that is linked to (that I was also just checking out) recommends skipping the config.ru file: "you’ll get more control over how your app is executed if you skip config.ru and instead declare your own web process type in a Procfile." However, following their instructions causes this problem, that you have, fortunately, solved for us.Ingraft

© 2022 - 2024 — McMap. All rights reserved.