Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

TypeError: value.replace is not a function #297

Closed
marcboquet opened this issue Apr 12, 2018 · 2 comments
Closed

TypeError: value.replace is not a function #297

marcboquet opened this issue Apr 12, 2018 · 2 comments
Assignees
Labels

Comments

@marcboquet
Copy link

marcboquet commented Apr 12, 2018

We were getting this error when running zapier convert:

TypeError: value.replace is not a function
    at Object.keys.forEach.key (lodash.templateSources[74]:19:19)
    at Array.forEach (<anonymous>)
    at eval (lodash.templateSources[74]:17:24)
    at /usr/local/lib/node_modules/zapier-platform-cli/lib/utils/convert.js:93:69
    at <anonymous>

Turns out there was an extra "v": 2 key in our "auth_mapping" and the code was trying to run regex on the integer.

We made it work by adding toString() in this line:

value = value.replace(/\{\{(\w+)\}\}/g, "${bundle.authData['$1']}");

value = value.toString().replace(/\{\{(\w+)\}\}/g, "${bundle.authData['$1']}");

Not sure this is the right fix, but maybe it helps other people.

@zapzap
Copy link

zapzap commented Apr 17, 2018

This issue has been copied into our private issue tracker. Thanks for the report! We'll update this as we learn more.

@eliangcs
Copy link
Member

@marcboquet thanks for reporting! Your solution looks good and I made a PR addressing this: #305.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants