Ruby on Rails Wednesday, October 31, 2018

I tried to use dire upload way from Ember app to Rails API and used ember-active-storage add-on. Rails responds with the following error when I tried to attach a file:

Cannot POST /rails/active_storage/direct_uploads
404 - Resource was not found.

All Rails controller are protected with before_action filter defined in ApplicationController:

class ApplicationController < ActionController::API



before_action
:authorize_request


  attr_reader
:current_user


 
private


 
def authorize_request
   
@current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]
 
end
end


I inspected the headers used when posting the request, - it seems to be OK and contains Authorization:

Authorization:
Bearer eyJhbG.....



and the request payload:

  1. blob{filename: "Screenshot 2018-10-31 at 10.45.21.png", content_type: "image/png", byte_size: 110466,…}
    1. byte_size110466
    2. checksum"L+1wS2rPR7cKkXP/Rb/rig=="
    3. content_type"image/png"
    4. filename"Screenshot 2018-10-31 at 10.45.21.png"




What's wrong with that ? Thank you.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f6068bec-9fe4-4019-9691-c535ac051b9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment