Hi! I’m building an Action and trying to use `fetch` via code mode. However, when doing so I receive a “ReferenceError: fetch is not defined”. In doing some research, it appears that Node.js needs to be v18 in order to use this. Is this correct? Is there a workaround?
@Todd Harper thank you for your reply! I tried out your code and received the following error response.
When I ran this is npm.runkit.com/supertest I got the following result.
Hi @sgee!
Huh. It clearly returns an array in your npm.runkit.com test, so I’m surprised that the error message you’re seeing says an array was not returned.
Are you running this test from within the Zapier editor? Can you screenshot the entirety of the “Action” and “Test” steps (of course, please obfuscate or redact your access token).
Hi @Todd Harper,
Yes, I’m running this test from within the Zapier editor. Ultimately, I’d like to get to where I can use the `params` to pass the projectId and access_token, but I just hardcoded my projectId and access_token to test the code you sent over. Here are the screenshots.
Oh! @sgee, you are using the developer platform, not a Code by Zapier step. That makes more sense given the level of detail your error message provided.
I don’t have an answer for you, unfortunately, but you may want to consider reposting this in the Developer Zone (or perhaps ask the admins to move it) to get more opinions specific to the Zapier Developer Platform (https://platform.zapier.com/), which I actually have very little experience using.
The “Code & Webhooks” area is technically reserved for questions about the Code by Zapier and Webhooks by Zapier apps within the user-facing side of Zapier (https://zapier.com/).
@Todd Harper shoot! I thought that’s what I was doing, but it looks like I didn’t get the right forum category selected Sorry for wasting your time. I appreciate the help you’ve given me so far, tho!
@sgee Not a waste of time at all!! I still think the code I provided here will work for you, but there may just be some minor modifications needed to make it work in Zapier Platform. People over in that forum have some really great insights, so I’m confident you’ll get the issue resolved :)
Crosspost of the post in the Developer Discussion forum: