CredentialEngine / CredentialRegistry

Repository for development of the Credential Registry
Apache License 2.0
12 stars 10 forks source link

Production: Encountering Can't Find Organization error where organization has been registered #390

Closed mparsons-ce closed 3 years ago

mparsons-ce commented 3 years ago

I encountered errors publishing some learning opportunities. All three of the errors were related to the condition: "Couldn't find Organization". The latter typically occurs if the owning org for a document has not been registered. One of the three learning opportunities had been published before using the Credential Engine keys (old method), so the organization didn't really have to exist (but they do as shown below).

Example 1 I tried to publish a learning opportunity (ce-68ee4ac7-32d5-4f27-92f4-a3ed45aff05a) and got the message: "Couldn't find Organization" The organization was Madison Area Technical College, with CTID: ce-67c45100-b6d7-413d-9924-f0d5adb825f1 The latter is found in: https://credentialengineregistry.org/metadata/organizations

{
id: "7cd1b2a3-8f91-4064-a1d6-4c0672b076fd",
name: "Madison Area Technical College",
_ctid: "ce-67C45100-B6D7-413D-9924-F0D5ADB825F1",
description: null,
},

The CTID is upper case, which may or may not be a factor. This was published using the old method with the credential engine keys. I had already started to include the metadata parameters (owned_by, published_by): https://credentialengineregistry.org/ce-registry/envelopes?update_if_exists=true&skip_validation=true&owned_by=ce-67c45100-b6d7-413d-9924-f0d5adb825f1&published_by=ce-67c45100-b6d7-413d-9924-f0d5adb825f1 I thought that might be a factor, even though the organization did exist. I then tried again without the extra metadata parameters (owned_by, published_by) and it worked! Note that I successfully published 89 learning opps using a url that included the metadata parameters, so this should not strictly be the solution.

The other two learning opps had been published using the registry managed keys. I tried both of these with and without the published_by parameter. In both cases I get the Can't find organization error. Example 2

{ id: "ace6d388-7496-4c0f-887d-6df12ecd9956", name: "Northwest Energy Efficiency Council (NEEC)", _ctid: "ce-db19fb99-fb9e-4fd0-a7fb-28d44745842b", description: null, },

Example 3

{ id: "de3b6d83-67db-4738-87bb-7575a499443d", name: "Charter Oak State College", _ctid: "ce-FC87A4F8-FB47-449C-8310-E5F10755FAE4", description: null, }, The CTID is upper case, which may or may not be a factor.

mparsons-ce commented 3 years ago

More symptoms Tried to publish credential: Bachelor of Science in Early Childhood Education, ce-c515b36d-f774-4c77-ac7b-5a3191a8577d Organization: Charter Oak State College, ce-fc87a4f8-fb47-449c-8310-e5f10755fae4 This org has a null publisher_id on the envelope, so maybe there is a relationship to #368

_I checked the other two organizations referenced above and both have null for publisherid.

I was doing a mass republish of credentials (2500), and most failed. I checked many and all had a null publisher_id.

@excelsior Can all null publisher_ids just be set to e8aa2734-5f6d-473a-9cf7-bc184439a1ac

OR do we just to a mass transfer of owner for all organizations that were published the old way? The next step would be to the same for all documents published the old way.

excelsior commented 3 years ago

@mparsons-ce

  1. CTIDs are case-sensitive. Since those are unique identifiers, it only make sense to match them as-is.
  2. I'm not sure why Example 2 doesn't work for you. I've emailed you a cURL snippet with a request updating that document which worked for me.
  3. Setting the publisher ID won't have any effect, its irrelevant to the concept of ownership.
mparsons-ce commented 3 years ago

@excelsior This issue is happening more regularly. One common symptom is the owning organization has publisher_id null on the envelope. Indiana Wesleyan University, ce-67c20b04-d34d-4201-ab1a-e058ca08b37e The organization can be republished, including today: image

The org has been registered. image

But attempts to publish credentials for the org result in an Organization not found error from the CER endpoint.

excelsior commented 3 years ago

@mparsons-ce Could you please email me a cURL snippet demonstrating the problem, since I have a hard time trying to reproduce it.

I took one of the above organization's envelopes (they all have no publisher_id) and republished it using the registry keys (sent you the cURL code I used for that). It worked just fine, and the publisher_id isn't blank anymore.

mparsons-ce commented 3 years ago

@excelsior Another one: University of California, Riverside envelope_id: "74db0327-12a8-4829-af36-52b47ce9fe29", envelope_ceterms_ctid: "ce-9fe93f5f-e0cf-40b2-9194-2ed178e115bb",

image

registered with an upper case CTID image

The assistant API has no way to determine if the registered CTID was upper or lower case. Can these be all set to lower case, if comparisons cannot be case insensitive? Is the issue a combination of null publisher_Id and upper case CTIDs in the organization metadata?

siuc-nate commented 3 years ago

Next step: Make all CTIDs lowercase across the board

mparsons-ce commented 3 years ago

We created task (#391 ) to convert all ctids to lower case, and convert all envelopes created the old way (#393 ) to address this issue, so closing this one.