Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SUPPORTESC-148 fix(core): stashFile no longer throws 'source.on' error when a request that uses await is passed in #361

Merged
merged 2 commits into from
Apr 26, 2021

Conversation

nicolemichellethomas
Copy link
Contributor

@nicolemichellethomas nicolemichellethomas commented Apr 20, 2021

This Pull Request fixes this issue

Previously, when await was used on a request that was passed to z.stashFile like so:

const x = await z.request(...);
return z.stashFile(x);

formData would throw the source.on is not a function. This PR fixes that issue.

Jira: https://zapierorg.atlassian.net/browse/SUPPORTESC-148

@nicolemichellethomas nicolemichellethomas changed the title fix(core): stashFile no longer throws 'source.on' error when a request that uses await is passed in SUPPORTESC-148 fix(core): stashFile no longer throws 'source.on' error when a request that uses await is passed in Apr 20, 2021
@xavdid
Copy link
Contributor

xavdid commented Apr 20, 2021

@nicolemichellethomas thanks for this PR! I'll dig into this in earnest tomorrow (unless someone else beats me to it). In the meantime, can you link your jira card and provide a little context in the PR description? End-users don't have jira access, so being able to read the PR helps them understand changes for the code they use.

Sounds like this one fixing an issue where an error is thrown, but shouldn't be?

@nicolemichellethomas
Copy link
Contributor Author

@xavdid You bet, sorry about that! Wasn't sure about the protocol 😅 Let me know if you have any questions or need anything else!

eliangcs
eliangcs previously approved these changes Apr 23, 2021
Copy link
Member

@eliangcs eliangcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed it fixes the issue. I only have a suggested change on the var vs. let lining error.

The file stasher code is one of the spots that always take me a long time to understand. So really appreciate you took the time to read the code and fix it!

packages/core/src/tools/create-file-stasher.js Outdated Show resolved Hide resolved
Changing let to var

Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>
@nicolemichellethomas
Copy link
Contributor Author

nicolemichellethomas commented Apr 23, 2021

@eliangcs Awesome! I've committed the var -> let change you suggested :)

Copy link
Member

@eliangcs eliangcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@nicolemichellethomas nicolemichellethomas merged commit 4ee4e11 into master Apr 26, 2021
@nicolemichellethomas nicolemichellethomas deleted the add-stashFile-async-await branch April 26, 2021 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

source.on is not a function errors when using async / await for z.stashFile
3 participants