cloudinary_npm icon indicating copy to clipboard operation
cloudinary_npm copied to clipboard

callback is not a function

Open JasonLMoffit opened this issue 6 years ago • 2 comments

Bug report for Cloudinary NPM SDK

Before proceeding, please update to latest version and test if the issue persists

Describe the bug in a sentence or two.

…

Issue Type (Can be multiple)

\node_modules\cloudinary\lib\utils\index.js:1154
    return callback(void 0, result);

[ ] Build - Can’t install or import the SDK [ ] Babel - Babel errors or cross browser issues [ ] Performance - Performance issues [ ] Behaviour - Functions aren’t working as expected (Such as generate URL) [ ] Documentation - Inconsistency between the docs and behaviour [ ] Incorrect Types - For typescript users who are having problems with our d.ts files [ ] Other (Specify)

Steps to reproduce

… if applicable

Error screenshots

… if applicable

Browsers (if issue relates to UI, else ignore)

[ ] Chrome [ ] Firefox [ ] Safari [ ] Other (Specify) [ ] All

Versions and Libraries (fill in the version numbers)

Cloudinary_NPM SDK version Node - 0.0.0 NPM - 0.0.0

Config Files (Please paste the following files if possible)

Package.json

Repository

const app = express();

app.use(bodyParser.json({ limit: "5mb" }));

app.use(bodyParser.json({ extended: false }));

// db
const connectDB = async () => {
  try {
    const success = await mongoose.connect(process.env.DATABASE_CLOUD, {
      useNewUrlParser: true,
      useUnifiedTopology: true,
      useCreateIndex: true,
      useFindAndModify: false,
    });
    console.log("DATABASE connected".brightBlue);
  } catch (err) {
    console.log(colors.red(err));
  }
};
connectDB();

app.use(cors());

// types (query | mutation | subscription)
const typeDefs = mergeTypeDefs(
  loadFilesSync(path.join(__dirname, "./typeDefs"))
);
const resolvers = mergeResolvers(
  loadFilesSync(path.join(__dirname, "./resolvers"))
);

// graphql server
const apolloServer = new ApolloServer({
  typeDefs,
  resolvers,
  context: ({ req, res }) => ({ req, res }),
});

apolloServer.applyMiddleware({ app });

// Server
const httpServer = http.createServer(app);

app.get("/rest", authCheck, (req, res) => {
  res.json({
    data: "You hit rest a endpoint",
  });
});

cloudinary.config({
  cloud_name: process.env.CLOUDINARY_CLOUD_NAME,
  api_key: process.env.CLOUDINARY_API_KEY,
  api_secret: process.env.CLOUDINARY_API_SECRET,
});

// upload
app.post(
  "/uploadimages",
  authCheckMiddleware,

  (req, res) => {
    cloudinary.uploader
      .upload(
        req.body.image,
        (res) => {
          res.send({
            url: res.url,
            public_id: res.public_id,
          });
        },
        {
          public_id: `${Date.now()}`,
          resources_type: "auto", //! may need to remove if it throws an error.
        }
      )
      .then((callback) => callback());
  }
);

JasonLMoffit avatar Nov 09 '20 02:11 JasonLMoffit

May I ask for some more information about your bug report please? That looks like your own code at the end, but I don't see a question or information about where you think the SDK needs to be changed. If you're trying to integrate the SDK into your application and are encountering an error with your integration rather than with the SDK itself, can you please let me know what that error is and in what circumstances it occurs?

igy avatar Nov 09 '20 10:11 igy

Closing this issue due to the time elapsed. Please feel free to either re-open the issue, contact our support at http://support.cloudinary.com, or create a new ticket if you have any additional issues.

roeeba avatar Dec 20 '20 14:12 roeeba