在解析云中找不到sign_cloudinary_upload_request方法

时间:2015-09-30 12:58:22

标签: parse-platform parse-server cloudinary

我正在使用Cloudinary和Parse。当我尝试上传视频时,我从Parse云中收到以下错误。错误似乎是说方法cloudinary.sign_cloudinary_upload_request(…)不存在。我有什么想法可以解决这个问题吗?

这是错误:

com.parse.ParseRequest$ParseRequestException: TypeError: Object #<Object> has no method 'sign_cloudinary_upload_request'
at main.js:64:33
at com.parse.ParseRequest.newPermanentException(ParseRequest.java:348)
at com.parse.ParseRESTCommand.onResponseAsync(ParseRESTCommand.java:271)
at com.parse.ParseRequest$3.then(ParseRequest.java:196)
at com.parse.ParseRequest$3.then(ParseRequest.java:192)
at bolts.Task$14.run(Task.java:796)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeAfterTask(Task.java:787)
at bolts.Task.continueWithTask(Task.java:599)
at bolts.Task.continueWithTask(Task.java:610)
at bolts.Task$12.then(Task.java:702)
at bolts.Task$12.then(Task.java:690)
at bolts.Task$14.run(Task.java:796)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)

以下是相关的main.js部分,第64行是cloudinary.sign_cloudinary_upload_request(…)

Parse.Cloud.define("sign_cloudinary_upload_request",function(request,response){
    if(!request.user || !request.user.authenticated()){
        response.error("Needs an authenticated user");
        return;
    }
    response.success(
                     cloudinary.sign_cloudinary_upload_request({tags:request.user.getUsername(),eager:{crop:"fill",width:THUMBNAIL_WIDTH,height:THUMBNAIL_HEIGHT,gravity:"face"}})
    );
});

1 个答案:

答案 0 :(得分:2)

如果您刚刚复制并粘贴了代码,那么它将起作用。你的问题&#34;是你似乎在自己打字。所以不,确实没有cloudinary.sign_cloudinary_upload_request方法cloudinary.sign_upload_request这样的方法参考样本:https://github.com/cloudinary/cloudinary_parse/blob/master/sample/cloud/main.js

Parse.Cloud.define("sign_cloudinary_upload_request", function(request, response) {
    if (!request.user || !request.user.authenticated()) {
        response.error("Needs an authenticated user");
        return;
    }
    response.success(
        cloudinary.sign_upload_request({tags: request.user.getUsername(), eager: {crop: "fill", width: 150, height: 100, gravity: "face"}})
    );
});

只需复制并粘贴:保持简单。