question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'type' of undefined when handling response from sendMessageDIDCommAlpha1

See original GitHub issue

Bug severity 2

Describe the bug TypeError: Cannot read property 'type' of undefined resulting in not being able to validate Message + save it:

  • When a cloud agent responds with a Message to local agent after sendMessageDIDCommAlpha1
  • When a cloud agent sends local agent a Message containing a VP requested by SDR via sendMessageDIDCommAlpha1

To Reproduce Steps to reproduce the behaviour:

  1. Create VC and send it to a cloud agent with sendMessageDIDCommAlpha1
  2. You will get an error upon receiving a response from the cloud agent
  3. Create a SDR with createSelectiveDisclosureRequest and send it to a cloud agent with sendMessageDIDCommAlpha1
  4. You will get an error upon receiving a response from the cloud agent
  5. Respond to SDR as cloud agent by doing the following: getVerifiableCredentialForSdr -> createVerifiablePresentation -> send its jwt via sendMessageDIDCommAlpha1
  6. Local agent will get the message from the cloud agent but errors out.

Quick way of reproducing This is a message received from the cloud agent: (as per DEBUG=*)

{
   "raw":"{\"from\":\"did:web:lighthouse.bolte.id\",\"to\":\"did:web:veramo-klaus.herokuapp.com\",\"type\":\"jwt\",\"body\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.eyJpYXQiOjE2MjM3NTM0MDUsInR5cGUiOiJzZHIiLCJ0YWciOiIxNTA2MjExMjM2IiwiY2xhaW1zIjpbeyJpc3N1ZXJzIjpbeyJkaWQiOiJkaWQ6d2ViOmxpZ2h0aG91c2UuYm9sdGUuaWQiLCJ1cmwiOiJodHRwczovL2xpZ2h0aG91c2UuYm9sdGUuaWQifV0sImNyZWRlbnRpYWxUeXBlIjoiUHJvZmlsZSIsImNsYWltVHlwZSI6Im5hbWUiLCJyZWFzb24iOiJXZSB3YW50IHRvIGNoZWNrIHlvdXIgZGVncmVlIGZvciB5b3VyIG5ldyBqb2IhIiwiZXNzZW50aWFsIjp0cnVlfV0sImlzcyI6ImRpZDp3ZWI6bGlnaHRob3VzZS5ib2x0ZS5pZCJ9.PzglNtd98QNFtj6ItCinystnrCSLcZ-snVIJFeHSmLdmUDsNnp5OM8wm9WUhGPL2BjOcFBw9GdBmsTt_gJ59Fw\",\"id\":\"f8f695a6-9932-48e1-957f-44ed498a135f\"}",
   "metaData":[
      {
         "type":"DIDComm-sent"
      }
   ],
   "save":true
}

When using handleMessage:

  • on cloud agent, the message gets validated. No error.
  • on local agent, I get TypeError: Cannot read property 'type' of undefined

Observed behaviour See above.

Expected behaviour Response should be validated an saved to local agent.

Details I am pretty sure this is a problem on my side but am very unsure where this is coming from. When doing the same between two cloud agents (on Heroku), all works great.

Additional context Cloud agent is on Heroku

Two Debug logs:

  • VC Creation + Sending (Cloud agents receives Message with VC fine (line 38) but local agent can’t handle response)
  • SDR + Sending (Cloud agents receives Message with VC fine (line 36) but local agent can’t handle response)

My Veramo setup file How I spin up the local remote server How I inject the routes to express

Versions (please complete the following information):

  • Veramo: 1.2.0 (also tried with @next on local agent)
  • Node Version 14.15.3

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
strumswellcommented, Jun 15, 2021

Wow, that was it. Thank you so much and sorry for bothering you! I wasn’t aware that order matters 😅 You can close the issue.

PS: I really, really like Veramo. Y’all are doing amazing work! 🎉 Can’t wait for LD proof support!

1reaction
strumswellcommented, Jun 16, 2021

Thanks for making me aware of this part of the discussion page. As of right now, the project is not really in a presentable state but I’ll definitely will do it in a later stage! You’ll also probably have some good input. 🙂

One (not so) quick note: My project is not about interop, that’s been done before. The goal is to get an overview over multiple solutions in the space, select a few, and implement them in a reference implementation (loosely based on VC-HTTP-API as starting point) to see how much they cover the VC lifecycle. All learnings (+ expert questionnaires) will flow into an evaluation framework for SSI solutions that new developers can use as a starting point.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unhandled Rejection (TypeError): Cannot read property 'type ...
state.profilePage is undefined. Unless you have some more code you are not showing, your are not setting profilePage anywhere on the code above ......
Read more >
ERROR TypeError: Cannot read property title of undefined
HEY, SET YOUR LIKE THERE ! ... Your browser can't play this video. ... Solved: ERROR TypeError : Cannot read property title of...
Read more >
React TypeError: Cannot read property function of undefined
SET YOUR LIKE THERE ...
Read more >
Cannot read property 'type' of undefined error coming in log
I am creating my first custom alexa skill.Kindly help me in the same.I have been getting this error every time. The intent response...
Read more >
How to deal with TypeError: Cannot read property - Codedamn
In JavaScript, undefined is not considered as an object type. Only object types have properties and one can access properties only if the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found