Making a New Playlist via Spotify API

I’m working on a Node.js application that utilizes the Spotify Web API to create playlists. My authentication is functioning properly, and I can see that my access token logs correctly. However, when I attempt to send a POST request to create a playlist, the request just hangs and does not complete.

Here is the code I’m using:

app.get('/makePlaylist', function(req, res) {
  
  console.log('token=' + auth_token)
  
  request.post(
    'https://api.spotify.com/v1/users/' + userId + '/playlists',
    {
      headers: {
        'Authorization': auth_token,
        'Content-Type': 'application/json'
      },
      json: {
        name: 'My New Playlist',
        public: false,
        collaborative: false,
        description: 'Created on ' + new Date().toISOString()
      }
    },
    function(err, resp, data) {
      if (!err && resp.statusCode === 200) {
        console.log(data);
        res.json(data);
      } else {
        console.log('Error:', err);
        res.status(500).send('Failed to create playlist');
      }
    }
  );
});

Although my authorization token outputs fine, the POST request does not receive a response. I am working with Node.js v12.14.1 and the request library. Has anyone experienced this issue? What might be the reason for the request hanging like this?

check your auth_token format - it should be 'Bearer ’ + your_actual_token, not just the token itself. also, spotify’s api changed recently, so make sure you’re using the right endpoint url.