Issue with GPT Action Sending Empty Body in Multipart Form Requests

Hi,

I’m experiencing an issue with a GPT action that is supposed to send a multipart/form-data request to my server.
The action is triggered correctly, but the body of the request is empty, as shown by {} in the logs.
This issue does not occur when I use Postman to send the request, which leads me to believe that it might be related to the way GPT handles multipart requests.

  • I’m using a Node.js backend with Multer for handling file uploads.
  • The request is meant to upload an image with associated user data.
  • In Postman, the request works perfectly, and the server processes it as expected.
  • When the same request is sent via the GPT action, the body is empty : {}

Here is the code for the server-side function :

app.post(‘/uploadProfileImage’, upload.single(‘image’), async (req, res) => {
try {
const containerName = ‘my-service’;
const containerClient = blobServiceClient.getContainerClient(containerName);
console.log(‘req.body :’, req.body);
const { email } = req.body;
console.log(‘email :’, email);
const formattedEmail = formatEmailForStorage(email).trim().replace(/\r?\n|\r/g, “”);
console.log(‘formattedEmail :’, formattedEmail);
const blobName = ${formattedEmail}/profil/profile.png;
const blockBlobClient = containerClient.getBlockBlobClient(blobName);

await blockBlobClient.upload(req.file.buffer, req.file.size, {
  blobHTTPHeaders: { blobContentType: req.file.mimetype }
});

// Vérifiez si le blob existe pour obtenir l'URL générique
const exists = await blockBlobClient.exists();
if (!exists) {
  return res.status(500).json({ message: 'Erreur lors de la récupération de l\'URL de l\'image.' });
}

// Utiliser l'URL générique du blob
const blobUrl = blockBlobClient.url;

// Mise à jour du profil utilisateur dans Firebase avec l'URL de l'image
updateUserPhotoInFirebase(email, blobUrl, (err, message) => {
  if (err) {
    console.error('Erreur lors de la mise à jour de l\'utilisateur dans Firebase :', err);
    res.status(500).json({ message: 'Erreur lors de la mise à jour de l\'utilisateur dans Firebase.' });
  } else {
    res.status(200).json({ message: `Image uploadée avec succès. Photo URL: ${blobUrl}` });
  }
});

} catch (error) {
console.error(‘Erreur lors de l'upload de l'image :’, error.message);
res.status(500).json({ message: 'Erreur lors de l'upload de l'image : ’ + error.message });
}
});

This is how the request body should look:

{
  "email": "user@example.com",
  "image": "[binary image data]"
}

But the GPT action sends this instead:

{}

Is there a known issue with GPT actions and multipart/form-data requests? How can I ensure that the GPT action sends the data correctly as it does in Postman?

1 Like