You'll need to run `wrangler dev` in order to run the JS file.
You'll need to run
wrangler dev in order to run the JS file.start script)tsc outputs a Javascript file. But you can't run that Javascript file directly with Node.js, it's not compatible.<path>/bin/node ./out/index.js which makes it seem like you're running it directly with Node.

import {v2 as cloudinary} from "Cloudinary"
import fs from "fs"
cloudinary.config({
cloud_name: process.env.CLOUDINARY_CLOUD_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET
});
const uploadOnCloudinary = async (localFilePath) => {
try {
if (!localFilePath) return null
//upload the file onCloudinaryy
const response = await cloudinary.uploader.upload(localFilePath, {
resource_type: "auto"
})
// file has been uploadedsuccessfull
//console.log("file is uploaded onCloudinaryy ", response.url);
fs.unlinkSync(localFilePath)
return response;
} catch (error) {
fs.unlinkSync(localFilePath) // remove the locally saved temporary file as the upload operation got failed
return null;
}
}
export {uploadOnCloudinary}// code
const body = await ctx.req.parseBody()
console.log(body["image"]);
// output
image: File {
lastModified: 1712061871701,
name: 'm5.jpg',
type: 'image/jpeg',
size: 84673
}
import {v2 as cloudinary} from "Cloudinary"
import fs from "fs"
cloudinary.config({
cloud_name: process.env.CLOUDINARY_CLOUD_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET
});
const uploadOnCloudinary = async (localFilePath) => {
try {
if (!localFilePath) return null
//upload the file onCloudinaryy
const response = await cloudinary.uploader.upload(localFilePath, {
resource_type: "auto"
})
// file has been uploadedsuccessfull
//console.log("file is uploaded onCloudinaryy ", response.url);
fs.unlinkSync(localFilePath)
return response;
} catch (error) {
fs.unlinkSync(localFilePath) // remove the locally saved temporary file as the upload operation got failed
return null;
}
}
export {uploadOnCloudinary}// code
const body = await ctx.req.parseBody()
console.log(body["image"]);
// output
image: File {
lastModified: 1712061871701,
name: 'm5.jpg',
type: 'image/jpeg',
size: 84673
}