goto / compass

Metadata storage service
https://goto.github.io/compass/
Apache License 2.0
2 stars 0 forks source link

Creating asset with uuid gives internal server error #5

Closed sudo-suhas closed 1 year ago

sudo-suhas commented 1 year ago

Describe the bug Creating asset with owner's uuid gives an internal server error.

To Reproduce Sample request:

curl -X PUT -vs 'http://compass.server.address/v1beta1/assets' \
  -H 'Compass-User-UUID: test' \
  -H 'Compass-User-Email: test@test.com' \
  -d '{
    "asset": {
      "urn": "urn:firehose:p-godata-id:job:test-owner-uuid", 
      "type": "job",
      "name": "test-owner-uuid",
      "service": "firehose",
      "description": "Migrated from system?",
      "owners": [{"uuid": "1aecb8b3-23a9-4456-8ebd-3aafc746fff8"}]
    }
  }' | jq
> PUT /v1beta1/assets HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.79.1
> Accept: */*
> Compass-User-UUID: test
> Compass-User-Email: test@test.com
> Content-Length: 288
> Content-Type: application/x-www-form-urlencoded
>
} [288 bytes data]
< HTTP/1.1 500 Internal Server Error
< Content-Type: application/json
< Date: Thu, 23 Mar 2023 02:40:15 GMT
< Content-Length: 79
<
{ [79 bytes data]
{
  "code": 13,
  "message": "Internal Server Error - ref (1679539215)",
  "details": []
}

Logs from server:

ERRO[0027] error inserting asset to DB: error running insert owners query: error running insert owners query: error running query: ERROR: invalid input syntax for type uuid: "" (SQLSTATE 22P02)  ref=1679539092
ERRO[0027] finished unary call with code Internal        error="rpc error: code = Internal desc = Internal Server Error - ref (1679539092)" grpc.code=Internal grpc.method=UpsertAsset grpc.service=gotocompany.compass.v1beta1.CompassService grpc.start_time="2023-03-23T08:08:12+05:30" grpc.time_ms=28.688 peer.address="127.0.0.1:50588" span.kind=server system=grpc

Expected behavior The asset should get created and the user should be upserted into the users table.

Additional context The problem was originally reported here:

https://github.com/odpf/compass/issues/216