Node.js: callback is not a function (Google Cloud function)

I need a Google Cloud function that uses the Vision API (Safe Search) and gives back the results. This is my approach (I’m using the inline editor in the browser):

index.js:

exports.pruefeNSFW = async (req, res) => {
  let inp = req.query.storagefile;

  const vision = require('@google-cloud/vision');
  // Creates a client
  const client = new vision.ImageAnnotatorClient();

  // Performs safe search detection on the local file
  const [result] = await client.safeSearchDetection(inp);
  const detections = result.safeSearchAnnotation;

  console.log('Safe search:');
  console.log(`Adult: ${detections.adult}`);
  console.log(`Medical: ${detections.medical}`);
  console.log(`Spoof: ${detections.spoof}`);
  console.log(`Violence: ${detections.violence}`);
  console.log(`Racy: ${detections.racy}`);

  res.status(200).send(detections);
};

package.json:

{
  "name": "sample-http",
  "version": "0.0.1",
  "dependencies": {
    "@google-cloud/vision": "2.4.2"
  }
}

Test Input:

{
"storagefile": "https://firebasestorage.googleapis.com/v0/b/xxx.xxx.com/o/xxxxxxxxx"
}

The function crashes with this message:

Error: function terminated. Recommended action: inspect logs for termination reason. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging Details: callback is not a function

The logs only give this: Function execution took 2528 ms, finished with status: 'crash'


I don’t understand why it crashes. How can I fix this?