Rails server automatically stop when using cloudinary API

Comments

8 comments

  • Avatar
    Daniel Mendoza

    Can you please provide us details to the error message that you see?

    0
    Comment actions Permalink
  • Avatar
    Muhammad Zakwan

    My server console do not give any errors. It just stop suddenly. Below is the code that I use in my controller:

    def template
      result = Cloudinary::Uploader.destroy('SampleId')
      if result
        redirect_to page_settings_path, notice: "[EVENT] Image deleted!"
      else
        redirect_to page_settings_path, alert: "[EVENT] Image cannot be deleted!"
      end
    end

    I just want to delete the uploaded image from my cloudinary account. The API works. My "SampleId" image is being deleted. But my local rail server suddenly stopped.

    What may cause it?

    0
    Comment actions Permalink
  • Avatar
    Aleksandar Kostadinov

    Hi Muhammad,

    It's difficult to say yet with certainty what can cause this.

    What are the last things that are printed in the logs before the server stops?
    What versions of Rails and Ruby are you running?
    Do you have other dependencies in your project, can you reproduce it in a new rails app with only Cloudinary?

    0
    Comment actions Permalink
  • Avatar
    Muhammad Zakwan

    There is no errors printed. The server just stop. I'm using Ruby 2.5.1 and Rails 5.2.0 for my project.

    0
    Comment actions Permalink
  • Avatar
    Roee Ben Ari

    Hi Muhammad, 


    Looking at your account's logs, I see five calls to the destroy API, all of which are with status 200. 

    April 18th 2020, 14:54:06.087 200
    April 18th 2020, 02:04:42.308 200
    April 18th 2020, 01:22:51.966 200
    April 17th 2020, 07:07:54.101 200
    April 17th 2020, 06:50:50.339 200

    I, therefore, assume you're experiencing a local environment issue. If you'd share the last few lines of your server logs that lead to the shutdown, we might be able to investigate it further. 

    Thanks,
    Roee

     

    0
    Comment actions Permalink
  • Avatar
    Muhammad Zakwan

    Yes, I can delete the image. Yet, my server suddenly stop without any logs. It just hang for a few moment and then stop. Is there any mistakes on how I configured my cloudinary gem?

    I have tested that this commands work when using in .html.erb file:

    <!-- Display image -->
    <%= cl_image_tag("sample") %>
    <!-- Display image with specify size -->
    <%= cl_image_tag("sample", :width=>150, :height=>210) %>
    <!-- Display image Url -->
    <%= cloudinary_url("sample") %>

    Yet, still no success when using cloudinary API in the controller. Not sure what the problem. The API works but the server stop suddenly with no errors log.

    Any helps via TeamViewer is really appreciate. You can see the errors in action.

    0
    Comment actions Permalink
  • Avatar
    Aleksandar Kostadinov

    Hi Muhammad,

    Could you please raise a ticket with us at - https://support.cloudinary.com/hc/en-us/requests/new - so that we can schedule a screen share via Zoom?

    In the meantime, could you please try this with a new rails app that has no other dependencies apart from Cloudinary?

    0
    Comment actions Permalink
  • Avatar
    Muhammad Zakwan

    After vigorous testing for 5 days, I managed to fix the problem. LOL. It may because of this 4 below gems:

    byebug
    capybara (>= 2.15, < 4.0)
    chromedriver-helper
    selenium-webdriver

    Maybe it cause conflict with cloudinary gem. I'm not sure. But what I did is just remove them because I don't use it in my project. Then, deleted the gemfile.lock from app folder. Next, run again 'bundle install' command. This fix the problem, server being exited or stopped suddenly without any errors log when using cloudinary API.

    By the way, many thanks for your help especially Daniel Mendoza, Aleksandar Kostadinov and Roee Ben Ari. Thank you for wonderful gem for rails ruby. Yet, you may want to test why above 4 gems cause problem with cloudinary gem.

    0
    Comment actions Permalink

Please sign in to leave a comment.