I am getting the following error (it won't even get to the console.log part of my code):
ERROR error in cloudinary module Cannot convert undefined or null to object 09:05:40
at Function.keys (<anonymous>)
at setSignature (modules\cloudinary\index.js:15:14)
Here is my code:
modules/cloudinary/index.js:
export default function () {
this.nuxt.hook('render:setupMiddleware', (app) => {
app.use('/api/cloudinary/signature', setSignature)
})
function setSignature(req, res) {
try {
const payload = []
Object.keys(req.body).forEach((key) => {
payload.push(`${key}=${req.body[key]}`)
})
console.log(payload)
} catch (error) {
console.error('error in cloudinary module', error)
}
}
}
Something going on with the Object here. Anyone spot anything?
Updated:
Doing the following console.log gives me undefined on the req.body:
export default function () {
// const config = this.options.privateRuntimeConfig.cloudinary
this.nuxt.hook('render:setupMiddleware', (app) => {
app.use('/api/cloudinary/signature', setSignature)
})
function setSignature(req, res) {
try {
console.log(req.body)