Cannot read property 'id' of undefined (YouTube/Discord)

Using YouTube API to get latest video from YouTube channel and send to Discord channel.

I get this error when running a test with v2

TypeError: Cannot read property ‘id’ of undefined
at eval (eval at _pd_deep_evaluate (/var/task/params_evaluator.js:63:16), :2:55)
at _pd_deep_evaluate (/var/task/params_evaluator.js:63:16)
at MessagePort. (/var/task/params_evaluator.js:11:9)
at MessagePort.[nodejs.internal.kHybridDispatch] (internal/event_target.js:399:24)
at MessagePort.exports.emitMessage (internal/per_context/messageport.js:18:26)

Hi @EMar,

Could you share the action that faced the error? Is it the Youtube action or Discord action? A screenshot would be a great help either

@vunguyenhung it’s the Discord send_message step that won’t connect.

Hello @EMar,

Would you mind sharing the Discord - Send Message configuration or input? I couldn’t reproduce your issue with only this much information :pray:

@vunguyenhung what do you want me to share?
The configuration is connected to my Discord server and channel name is set.

Message:

Published: {{steps.trigger.event.snippet.publishTime}}
https://youtube.com/watch?v={{steps.trigger.raw_event.id.videoId}}

Username: Deep-tech News

And avatar image.

I didn’t add anything for the two optional settings: Thread ID & Include Link to workflow

It works in v1 but something is different in v2.

@EMar,

I tested the Discord - Send Message action works normally

I suspect that the part https://youtube.com/watch?v={{steps.trigger.raw_event.id.videoId}} is incorrect.

May be could you check the path steps.trigger.raw_event.id.videoId if it is correctly refer to the trigger event defined field?

@vunguyenhung I’ll give it a try, been a few months since I created it.

Maybe that string was changed to this: {{steps.trigger.event.id.videoId}}
Because I don’t see raw_event in the variables any more, in v2

{{steps.trigger.event.id.videoId}} actually worked, the YouTube URL is posted, not the video.

So I changed the Discord message to:

Published: {{steps.trigger.event.snippet.publishTime}}
- YouTube}{{steps.trigger.context.workflow_name}}

This seems to have fixed it, I removed the end tag:
{{steps.trigger.context.workflow_name}}

Result:

Published: {{steps.trigger.event.snippet.publishTime}}
https://youtube.com/watch?v={{steps.trigger.event.id.videoId}}


Why is the date not separated from the end code for this tag:

publishedAt: 2023-02-28T20:25:49Z

Minor issue, but there should be a space :dotted_line_face:

Cool, now I can add multiple triggers into one workflow with v2

1 Like