-
Notifications
You must be signed in to change notification settings - Fork 105
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
Error reporting for protocol definition missing protocolPath
could be more descriptive
#345
Comments
protocolPath
in Protocol Definition results in difficult to troubleshoot error messageprotocolPath
could be more descriptive
* Require of in protocol action rules * Opportunistically update var names allowRule -> actionRule * Update tests/validation/json-schemas/protocols/protocols-configure.spec.ts Co-authored-by: Henry Tsai <[email protected]> * PR comment: add anyone test * Lint --------- Co-authored-by: Henry Tsai <[email protected]>
picking this up |
@Rizina Assigned 🥳 reach out if you need any help |
@EbonyLouis it seems the original file mentioned changed a lot since the issue was opened. |
@Rizina I think the issue comment was updated with more information on how to tackle this issue. Let me know if it's still confusing to you in any way |
@EbonyLouis is this available? |
@frankhinek @diehuxx Is this still an issue? Better error messaging for |
@flothjl @EbonyLouis No longer an issue, #520 did in fact resolve this. |
Task Details:
Steps to Reproduce
Instantiate a DWN (e.g., in browser or Node env).
Create DIDs/keys for Alice and Bob
ProtocolsConfigure.create()
and process the following definition for both DWNs:Create a
RecordsWrite
message signed by Alice that is written to Bob's DWN referencing thechat
protocol andchat/message
schema. Excerpt fromRecordsWrite.create()
:When you call
processMessage
the response returned is:{ status: { code: 401, detail: "Cannot read properties of undefined (reading 'split')", }, entries: undefined, data: undefined, }
Expected Behavior
I made a mistake in the protocol definition by failing to include a
protocolPath
for both of the allow rules that involve theauthor
andrecipient
actors. It should have been:Given that, I would expect an error to occur. However, it would have saved a lot of troubleshooting time if the error had been more descriptive than
Cannot read properties of undefined (reading 'split')
. Fortunately, there aren't that many uses of.split()
in the code base so it didn't take all that long to track down.Potential Improvements
Idea A
One potential improvement would be to detect the missing
protocolPath
in the Allow Rules inProtocolAuthorization.getMessage()
:https://github.com/TBD54566975/dwn-sdk-js/blob/f8a150e4e5a276d521fada8e4a6f0bc0c6d9e3c5/src/core/protocol-authorization.ts#L384-L388
and throw a more informative message such as
'protocolPath' missing for 'allow' rule
.Idea B
Related to Issue #332, perhaps this could be caught during
ProtocolsConfigure
message ingestion?Picking Up This Issue:
Questions:
#hack-together
channel and collaborate with a buddy.#getting-started
channel.Resources:
Remember, communication is key! If you have any questions or face any challenges, we're here to help so please don't hesitate to reach out.
Good Luck! 🍁
The text was updated successfully, but these errors were encountered: