jdinicola/insomnia-plugin-get-access-token

Cannot read properties of undefined (reading 'value')

Closed this issue · 4 comments

I have a request:

POST api/1/access_token

{ "key": "string" }

Which returns

{
  ...
 "token": "jwt token"
}

And then i've set $.token as json-path filter as it said in the readme

But Authorize requests doesn't work, it throws an error:

TypeError: Cannot read properties of undefined (reading 'value')
    at Object.action (/Users/nt/Library/Application Support/Insomnia/plugins/insomnia-plugin-get-access-token/main.js:20:90)
    at async _class$b._handlePluginClick (file:///Applications/Insomnia.app/Contents/Resources/app.asar/index.20f288cc.js:4940:47977)

const path = request.headers.filter(header => header.name === 'JSONPath-filter')[0].value;

Hi @notiv-nt,

I think that the issue is that the "JSONPath-filter" header is not present on the request (or maybe it is, but is mispelled)... In any case, I've just published a new version of the plugin (1.0.2) with a more clear message and not the raw error.

Please, let me know if this helps.

Thank you for using the plugin 🙂

Yes, this is the error, but what to do with it ?
Missing "JSONPath-filter" request header and/or its value

Check that a header whit that exact name (JSONPath-filter) is present on the request and that is not empty

My bad, I'm blind, didn't see the 'add it the JSONPath-filter header with the filter'