Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PUT request RecordNotFound error #26

Open
blms opened this issue Dec 23, 2022 · 1 comment
Open

PUT request RecordNotFound error #26

blms opened this issue Dec 23, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@blms
Copy link

blms commented Dec 23, 2022

I'm not sure if this error is caused here, in triple-eye-effable, in UDCSL, or in resource-api. I've been able to see it on production as well as my local environment. I noticed it as a result of the error throwing introduced in performant-software/triple-eye-effable#6.

When trying to update a record, PUT using the UUID results in this error:

2:58:52 PM api.1 |  Processing by Public::ResourcesController#update as */*
2:58:52 PM api.1 |    Parameters: {"resource"=>{"project_id"=>"b4c66484-67a1-4680-a88c-699f9a9ca6d1", "name"=>"Medellín.pdf", "metadata"=>""}, "id"=>"5268a983-e7a0-45cd-b10f-8c4b555270de"}
2:58:52 PM api.1 |    User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" = $1 LIMIT $2  [["api_key", "0f8c10e-dfd4-2136-bf1b-123f10d58ea"], ["LIMIT", 1]]
2:58:52 PM api.1 |    ↳ app/controllers/public/resources_controller.rb:12:in `authenticate_request'
2:58:52 PM api.1 |    Resource Load (0.2ms)  SELECT "resources".* FROM "resources" WHERE "resources"."id" = $1 LIMIT $2  [["id", 5268], ["LIMIT", 1]]
2:58:52 PM api.1 |  Completed 404 Not Found in 3ms (ActiveRecord: 0.4ms | Allocations: 1473)
2:58:52 PM api.1 |  ActiveRecord::RecordNotFound (Couldn't find Resource with 'id'=5268a983-e7a0-45cd-b10f-8c4b555270de):
2:58:52 PM api.1 |  activerecord (7.0.2.4) lib/active_record/core.rb:284:in `find'
2:58:52 PM api.1 |  resource-api (54b103f2f1f3) app/controllers/api/resource_controller.rb:72:in `update'

Curiously, while this error silently happens in the background, the consuming application successfully pulls the record from the database and updates it.

@blms blms added the bug Something isn't working label Dec 23, 2022
@blms
Copy link
Author

blms commented Dec 23, 2022

It might be that this line simply needs :update added, but needs more investigation.

prepend_before_action :set_resource, only: [:show, :destroy]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant