matt-ball / postman-local

A client to facilitate local development of scripts for Postman.
Apache License 2.0
70 stars 6 forks source link

postman boostrap failing in mapItemToFile #24

Closed rucharnaud closed 4 years ago

rucharnaud commented 4 years ago

Hi,

tried to setup and experiment with postman-cli.

Here's the error I had: node:9881) UnhandledPromiseRejectionWarning: TypeError: item.find is not a function at mapItemToFile (/Users/myself/Workspace/postman-cli-sandbox/node_modules/@matt.ball/postman-cli/src/bootstrap.js:24:105) at recurseCollectionForItems (/Users/myself/Workspace/postman-cli-sandbox/node_modules/@matt.ball/postman-cli/src/lib/recurse-collection.js:32:20) at processTicksAndRejections (internal/process/task_queues.js:97:5)

I added a little bit of logging. It seems that the item at stake is: { name: 'Random cat pictures', _postman_id: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx', protocolProfileBehavior: { disableBodyPruning: true }, request: { method: 'GET', header: [], url: { raw: 'https://aws.random.cat/meow', protocol: 'https', host: [Array], path: [Array] } }, response: [] }

Its type is: 'request'

I guess the issue is coming from : const scriptObj = (item.event && item.event.find((el) => el.listen === type)) || (!item.event && item.find((el) => el.listen === type))

But I could not really decipher what we are trying to do, so I did not investigate further.

matt-ball commented 4 years ago

Thanks for reporting @rucharnaud

What version of both Node and the CLI are you using? Any chance you can share the collection you are using? (remove any secrets, export from the app)

rucharnaud commented 4 years ago

Hi @matt-ball ,

I'm using version 0.0.25 of postman-cli and node v12.16.1.

Here is the collection I've been using:

Perso.postman_collection.json.zip

Regards,

Arnaud

matt-ball commented 4 years ago

Thanks for sharing.

@rucharnaud please try 0.0.26 and let me know if that fixes the issue!

rucharnaud commented 4 years ago

Yes it does. Thank you @matt-ball

matt-ball commented 4 years ago

Great! I'll close this out - feel free to open another issue if you run into other bugs/have a feature request.