I’m not a Node expert but I do use JS quite a bit and I’m pretty sure the Fetch API (of which the Headers interface is apart of) is implemented by the browser’s window object, so it wouldn’t be available in Node.
A quick Google search pulled up this article which I think will solve your issue by replacing fetch with something supported by Node:
I’m a bit confused on whether you are using Node.js or not, so I’ll tell you few problems with your code, depending on if you’re using Node.js or not:
If you’re using Node.js
If you’re using Node.js, then your code should work, after you have done the instructions in the above post.
If you’re not using Node.js
If you’re not using Node.js, your code will work and you don’t need to do whatever I have said in the above post, but your authorization won’t work because you’re using process.env.SPOTIFY_TOKEN. Note that .env (referred to using process.env) variables are only available on Node.js (server-side) and not the browser (client-side).