smarty / smartystreets-javascript-sdk

The official client libraries for accessing SmartyStreets APIs from javascript.
https://smartystreets.com/docs/sdk/javascript
Apache License 2.0
31 stars 30 forks source link

'length' of undefined on buildUsAutocompleteProClient #27

Closed ronssij closed 3 years ago

ronssij commented 3 years ago

image

image

but when I use the buildUsAutocompleteClient() seems to be working on my end.

and I am blocked by this issue on Pro.

ronssij commented 3 years ago

Closing the issue

I used the new SmartyStreetsSDK.usAutocomplete.Lookup(lookup); instead of new SmartyStreetsSDK.usAutocompletePro.Lookup(lookup);

martinmckenna commented 2 years ago

This needs to be re-opened. not sure why a lot of these class props are seemingly required because the code assumes they will always be defined, when they don't need to be

camiblanch commented 2 years ago

@martinmckenna Can you reference which class and class props you are referring to?

martinmckenna commented 2 years ago

@camiblanch here for example:

https://github.com/smarty/smartystreets-javascript-sdk/blob/master/src/us_autocomplete_pro/Client.js#L36

joinFieldWith is referencing .length on properties that may not exist and (as far as I can tell) are completely optional. Which is why the error in the OP is happening.

This code is duplicated across multiple different classes as well, not just the autocomplete pro

martinmckenna commented 2 years ago

actually false alarm this was user error