Unknown bridge.js error when using Cloudinary in a Netlify function

Error - ENOENT: no such file or directory, open '/var/task/netlify/functions/bridge.js'

Stack trace
Error: ENOENT: no such file or directory, open '/var/task/netlify/functions/bridge.js'
at Object.openSync (node:fs:590:3)
at Object.readFileSync (node:fs:458:35)
at node_modules/vm2/lib/vm.js (/var/task/netlify/functions/demo.js:74426:122)
at __require (/var/task/netlify/functions/demo.js:22:50)
at node_modules/vm2/lib/main.js (/var/task/netlify/functions/demo.js:76020:9)
at __require (/var/task/netlify/functions/demo.js:22:50)
at node_modules/vm2/index.js (/var/task/netlify/functions/demo.js:76048:23)
at __require (/var/task/netlify/functions/demo.js:22:50)
at node_modules/degenerator/dist/src/index.js (/var/task/netlify/functions/demo.js:76060:17)
at __require (/var/task/netlify/functions/demo.js:22:50)
Connection details
Netlify internal ID: 01H3KZK1WH991F7DFE6YY747NX

I don’t have file called bridge.js, just demo.js:

import { v2 as cloudinary } from 'cloudinary';

// Configure Cloudinary with your credentials
cloud_name: '*****',
api_key: '*****',
api_secret: '*****'

exports.handler = async (event, context) => {
try {
// Create a text file with the word "HELLO"
const fileContent = 'HELLO';

// Upload the text file to Cloudinary
const result = await cloudinary.uploader.upload(fileContent, {
resource_type: 'raw',
folder: 'your_folder_name' // Optional: Specify the folder where you want to save the file

// The result object will contain information about the uploaded file

return {
statusCode: 200,
body: JSON.stringify(result)
} catch (error) {
console.error('Error uploading file:', error);

return {
statusCode: 500,
body: JSON.stringify({ message: 'Error uploading file' })

It still errors even if I remove the actual upload and just have the config part.

Based on your comment in the helpdesk, you’ve decided to switch to a different library.

I am curious about this also — bridge.js

"errorMessage":"ENOENT: no such file or directory, open '/Users/nick/code/real-hermes/.netlify/functions-serve/cloudinary/src/netlify/functions/cloudinary/bridge.js'"

Nowhere in the code am I looking for bridge.js, and I see no reference to it in cloudinary code either.

For me it seems like an issue with dependencies not being installed. not sure why it showed up as this error message though.