zendesk / zcli

A command-line tool for Zendesk
https://developer.zendesk.com
Apache License 2.0
56 stars 18 forks source link

zcli themes:import fails with 1 brand #194

Closed peterpiek1 closed 9 months ago

peterpiek1 commented 11 months ago

Expectations

zcli themes:import Theme imported successfully theme ID: 01234567-0123-0123-0123-0123456789ab ...

Reality

zcli themes:import Creating theme import job... ! › Error: TypeError - Value 360000123456 for /job/attributes/brand_id is of type number; expected string

Steps to Reproduce

  1. Only one brand in https://{subdomain}.zendesk.com/api/v2/brands.json
  2. Change to theme directory
  3. Execute zcli themes:import

Issue details

Possible solution

If there are multiple brands the brand_id value is converted to a string.

If there is only one brand the brand_id value returned is a number, see: https://github.com/zendesk/zcli/blob/fb0242c3d4ef04b3b9ad6cbfa2595439a07b35ca/packages/zcli-themes/src/lib/getBrandId.ts#L13C7-L13C26

Fix: change return brands[0].id to return brands[0].id.toString() Now the import succeeds.

luis-almeida commented 9 months ago

Thanks for opening the issue 🙏🏼 Closing it as this as been fixed in 1.0.0-beta.36