TypeErrorCannot read property 'name' of undefined

TypeError: Cannot read property ‘name’ of undefined
at eval (eval at _pd_deep_evaluate (/var/task/params_evaluator.js:57:18), :1:21)
at _pd_deep_evaluate (/var/task/params_evaluator.js:57:18)
at _pd_deep_evaluate (/var/task/params_evaluator.js:38:7)
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)

Getting the above error when using to pull data from Strava:

There is data in Strava but get this error sometimes
Using this:

Anyone have any ideas?

Hi @johnreeve68

First off, welcome to the Pipedream community. Happy to have you!

Thanks for the details about the error and steps you’re using. It sounds like perhaps you’re attempting to access some kind of data with the attribute name.

Something like strava.runner.name maybe?

This error means that you’re trying to access a property on a variable that doesn’t exist or is null. It could be that Strava is returning an empty field where you’re expecting some data.

The easiest way to solve this is use safety accessors (?.):

strava?.person?.name

This will not throw an error if any values are null or undefined along the chain. I hope this helps!

1 Like

Thanks Pierce - so easy when you know how!!!
Thanks for your help - that worked out really well

Hey Pierce - guess what - it happened again “Hey there - just tried to import the Strava data and have same problem - “TypeErrorCannot read property ‘0’ of undefined””

Driving me nuts - not consistent - it seems OK with cycling workouts but not when I do weights

Hi @johnreeve68

Oh no, that’s frustrating. Is the error happening at the trigger step or after?

Would it be possible for you to share the workflow with support? It’s a toggle under the Settings section of your workflow. That will help us see more context on what’s going on.

Hi Pierce. - thanks - the workflow is open for view - thanks

Pierce - see my other post - more detail n there
https://pipedream.com/community/t/strava-elements-missing/1938/8”

Hi, what’s a “safety accessor’s” function and definition?, I am getting the same error but I am very new to this and I don’t actually know how to apply this solution (to my ECWID/Google Sheets issue in particular).