DPassarelli/6-mils

`OutboundCxmlMessage` fails to accept `undefined` values for credentials

DPassarelli opened this issue · 2 comments

I came across this error while working on another project that relies on 6-mils:

TypeError: Cannot read property 'toString' of undefined
      at Repositories/.../.../node_modules/6-mils/lib/node_modules/@6-mils/OutboundCxmlMessage/index.js:63:56
      at Array.forEach (<anonymous>)
      at stringifyAndMerge (Repositories/.../.../node_modules/6-mils/lib/node_modules/@6-mils/OutboundCxmlMessage/index.js:62:22)
      at PunchOutSetupRequest.setBuyerInfo (Repositories/.../.../node_modules/6-mils/lib/node_modules/@6-mils/OutboundCxmlMessage/index.js:155:22)
      at module.exports (Repositories/.../.../app/node_modules/@punchout/route-handlers/carts/POST.js:63:8)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at async bodyParser (Repositories/.../.../node_modules/koa-bodyparser/index.js:95:5)

The only question is whether or not this behavior is desirable. Do we want undefined values to be silently accepted? In typical use-case scenarios, would it be more helpful to alert the dev right away that a value they think is valid is not?

I think it's best to keep this behavior, but (I believe) that changing it to not accept either undefined nor null values will result in a breaking change. In any case, it is time to drop support for Node 8, and add Node 14 to CI. So, semver-major it is 🎉