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

Not possible to upload documents with same authentic_source and document_id but different document_type #78

Open
JuAlMan opened this issue Aug 2, 2024 · 4 comments
Assignees
Labels
api_v2.8 bug Something isn't working

Comments

@JuAlMan
Copy link

JuAlMan commented Aug 2, 2024

Using image docker.sunet.se/dc4eu/apigw:apiv28

I uploaded a document with the following meta object:

"meta": {
    "authentic_source": "DE:DRV21001",
    "collect": {

    },
    "credential_valid_from": 0,
    "credential_valid_to": 0,
    "document_id": "12345",
    "document_type": "PDA1",
    "document_version": "1.0.0",
    "real_data": true
  }

Then i uploaded a second document by changing the document_type to "EHIC".
Querying the document with Type PDA1 works just fine but when i try to query with type EHIC i get an error
message that no documents could be found.
This is the request i used for queriying the EHIC document:

{
  "authentic_source": "DE:DRV21001",
  "document_id": "12345",
  "document_type": "EHIC"
}

As a document is identified by document_id, authentic_source and document_type it should be possible to upload documents with same id but different type.

@masv3971
Copy link
Collaborator

It's because the save call to the database goes via a async call.
Will change that behavior.

@JuAlMan
Copy link
Author

JuAlMan commented Sep 2, 2024

I tried:

"authentic_source": "DE:DRV70001",
"document_id": "123",
"document_type": "PDA1"

And then:

"authentic_source": "DE:DRV70001",
"document_id": "123",
"document_type": "EHIC"

It still doesn't seem to work, I get the following error:
"document_already_exists".

@masv3971
Copy link
Collaborator

Should be solved with, c706009

Please try the latest apiv28 docker tag.

@masv3971 masv3971 self-assigned this Sep 24, 2024
@JuAlMan
Copy link
Author

JuAlMan commented Sep 25, 2024

I still get a duplicate key error.
In the logs of the apigw container i get the following message:

Failed to save document {"error": "write exception: write errors: [E11000 duplicate key error collection: vc.datastore index: document_id_uniq dup key: { : \"12345\", : \"DE:DRV70001\" }]"}

It seems the document_type isn't respected as part of the unique key.

I used the 0.4.1 image tag now, but also tried with apiv28 and got the same error

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

No branches or pull requests

2 participants