Skip to content

task.StartCustom() fails with error #1

@prasadus92

Description

@prasadus92

Hi,

I am using the QEncode client with AWS Lambda, I think I have provided the necessary parameters, but still, it fails with the below error -

2019-12-11T10:44:45.434Z	fe924c75-999b-5bfd-9799-1a1f5355b508	ERROR	Invoke Error	
{
    "errorType": "SyntaxError",
    "errorMessage": "Unexpected token < in JSON at position 2",
    "stack": [
        "SyntaxError: Unexpected token < in JSON at position 2",
        "    at JSON.parse (<anonymous>)",
        "    at QencodeApiClient.Request (/var/task/node_modules/qencode-api/QencodeApiClient.js:70:29)",
        "    at TranscodingTask._do_request (/var/task/node_modules/qencode-api/Classes/TranscodingTask.js:83:33)",
        "    at TranscodingTask.StartCustom (/var/task/node_modules/qencode-api/Classes/TranscodingTask.js:79:21)",
        "    at createTranscodeTask (/var/task/transcode-request-handler.js:83:10)",
        "    at event.Records.forEach.record (/var/task/transcode-request-handler.js:28:9)",
        "    at Array.forEach (<anonymous>)",
        "    at processRequest (/var/task/transcode-request-handler.js:23:19)",
        "    at Runtime.exports.handler (/var/task/transcode-request-handler.js:19:5)",
        "    at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"
    ]
}

The code that I am using is given below (some details are stripped out for brevity) -

let transcodingParams = {};
transcodingParams.source = videoUrl;
transcodingParams.callback_url = CALLBACK_URL;

let videoFormat = {};
videoFormat.destination = {};
videoFormat.destination.url = destinationUrl;
videoFormat.destination.key = ACCESS_KEY;
videoFormat.destination.secret = SECRET_KEY;
videoFormat.destination.permissions = "public-read";
videoFormat.output = "mp4";
videoFormat.pix_format = "yuv420p";

let thumbnailFormat = {};
thumbnailFormat.destination = {};
thumbnailFormat.destination.url = thumbnailOutputUrl;
thumbnailFormat.destination.key = ACCESS_KEY;
thumbnailFormat.destination.secret = SECRET_KEY;
thumbnailFormat.destination.permissions = "public-read"
thumbnailFormat.output = "thumbnail";
thumbnailFormat.time = "0";
thumbnailFormat.width = "320";
thumbnailFormat.height = "240";


transcodingParams.format = [];
transcodingParams.format.push(videoFormat);
transcodingParams.format.push(thumbnailFormat);
task.StartCustom(transcodingParams, payload);
console.log("Transcoding task created successfully");

Can you guys please help me figure out what I am doing wrong here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions