Petr
Petr

Reputation: 2099

Heroku keeps crashing 500 with no description & heroku logs - log

My app is crashing on Heroku but localhost works without any issue

Log:

heroku router - - at=info method=POST path="/documents" host=www.getmehired.my request_id=368bcdf4-a236-4b40-af87-5f7c801d6654 fwd="61.6.109.144,162.158.165.159" dyno=web.1 connect=1ms service=3562ms status=500 bytes=1669 protocol=http
app web.1 - Completed 500 Internal Server Error in 3224ms (ActiveRecord: 30.5ms)
app web.1 - Errno::ENOENT (No such file or directory - java):
app web.1 - app/models/document.rb:24:in `update_information'
app web.1 - app/controllers/documents_controller.rb:6:in `create'

Dyno:

web bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development} ON
redis redis-server OFF
worker bundle exec sidekiq -c 3 ON

Documents_controller (using paperclip & aws to upload docs:

  def create
    @doc = Document.new(doc_params)
    if @doc.save
      @doc.update_information
      redirect_to users_edit_path
    else
      redirect_to root_path
    end
  end

Document model:

  def update_information
    cv = Yomu.new(self.cv.url)
    # THE NEXT COMMAND -> CRASH
    self.num_of_pages = cv.metadata['xmpTPg:NPages'] if cv.metadata['xmpTPg:NPages']
    self.num_of_characters = cv.text.size
    self.num_of_words = cv.text.split.size
    self.file_extension = self.cv_file_name.split('.').reverse.first
    self.file_updated_at = cv.metadata['modified'] || cv.metadata['Creation-Date'] || Time.now
    self.file_created_at =  cv.metadata['Creation-Date'] || Time.now
    self.save!
  end

Upvotes: 0

Views: 99

Answers (1)

fabOnReact
fabOnReact

Reputation: 5942

Read the following instructions

Installation and Dependencies

Java Runtime

Yomu packages the Apache Tika application jar and requires a working JRE for it to work.

The error you are receiving Errno::ENOENT (No such file or directory - java): is caused from the missing installation of the Java Runtime Environment on your Heroku Server.

As I can read here, I believe it may not be possible to install on Heroku the JRE.

I am quoting the following answers and you should try this options:

  1. If you are using the Heroku-16 Stack

you can add jvm as a buildpack and you don't need to configure paths or anything else. Just make sure to have it set as your first buildpack. I tried it with Yomu/Henkei and it worked for me.

  1. If you are using the Cedar Stack

then a JDK is available to you at: /usr/lib/jvm/java-6-openjdk I'm not sure how Yomu finds your Java install, but it's probably looking in JAVA_HOME. If so then setting JAVA_HOME on Heroku should make it work:

heroku config:add JAVA_HOME=/usr/lib/jvm/java-6-openjdk
  1. Third answer

a java runtime (a JRE, like the documentation said). Installing a JRE as an addon is not (yet?) supported on Heroku. Solution: Try other gems not based on JRE

Upvotes: 1

Related Questions