Coder Social home page Coder Social logo

transloadit / node-sdk Goto Github PK

View Code? Open in Web Editor NEW
59.0 10.0 26.0 1.87 MB

Transloadit's official Node.js SDK

Home Page: https://transloadit.com

License: MIT License

JavaScript 96.45% TypeScript 3.55%
transloadit encoding uploading file-api javascript sdk

node-sdk's People

Contributors

acconut avatar adrusi avatar aduh95 avatar chulanovskyi-bs avatar dependabot[bot] avatar ethanwillis avatar goto-bus-stop avatar greenkeeperio-bot avatar ifedapoolarewaju avatar kvz avatar mifi avatar nqst avatar onelifemedia avatar pkyeck avatar steelbrain avatar tim-kos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-sdk's Issues

New major version

Proposed changes:

  • promise API signature
    • expected by most people these days
  • async/awaitify internal code
    • reduce callback hell (deep nesting)
    • shorter & easier to read
    • reduce chance of missed Errors and other mistakes
  • Keep transpiling?
    • easier debugging for end users in non-transpiled code
    • complexity
  • Provide type definitions (or write in typescript)
  • OOP API vs Factory function
    • Many people are used to the OOP mindset (coming from java, c# etc)
    • OOP maybe easier to mock stuff?
    • Factory function code is much easier for linters to identify errors (eslint doesn't handle this well) and flow may be easier to read and refactor. this needs to be bound sometimes and is not always obvious what this is.
    • factory: better encapsulation, no need for fake encapsulation _methods
    • Many more arguments for both paradigms
  • Use jest?
  • Merge .eslintrc and .eslintrc.js
  • request is deprecated

Inconsistencies:

  • cosmetic: camelcase vs snake_case in API e.g. template_id vs waitForCompletion

Drawbacks of big rewrite:

  • need to rewrite all tests
  • users need to adapt to the new API (although it's not a huge API surface and new API will be very similar)

RequestError: connect ECONNREFUSED 127.0.0.1:443

Im using node version is 14.17.4 and npm version is 6.14.14

I'm to trying use transloadit on the local machine. But keep throwing an error.

RequestError: connect ECONNREFUSED 127.0.0.1:443
    at ClientRequest.<anonymous> (/home/ram/code/sample/node_modules/got/dist/source/core/index.js:956:111)
    at Object.onceWrapper (events.js:520:26)
    at ClientRequest.emit (events.js:412:35)
    at ClientRequest.origin.emit (/home/ram/code/sample/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
    at TLSSocket.socketErrorListener (_http_client.js:475:9)
    at TLSSocket.emit (events.js:400:28)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16) {
  code: 'ECONNREFUSED',
  timings: {
    start: 1628081393403,
    socket: 1628081393405,
    lookup: 1628081393407,
    connect: undefined,
    secureConnect: undefined,
    upload: undefined,
    response: undefined,
    end: undefined,
    error: 1628081393408,
    abort: undefined,
    phases: {
      wait: 2,
      dns: 2,
      tcp: undefined,
      tls: undefined,
      request: undefined,
      firstByte: undefined,
      download: undefined,
      total: 5
    }
  }
}

even I tried to check result host api2.transloadit.com

api2.transloadit.com has address 3.0.62.44
api2.transloadit.com has address 18.136.113.29
api2.transloadit.com has address 3.0.156.156

and also checked results of npm ls got

I tried on 4 local machines but unfortunately I got same error on all the machines
everything looks perfect but still facing issues.

eslint rules

I wrote a little script that compares rules from eslint-config-airbnb-base and eslint-config-standard.

Results

Rules in standard but not in airbnb

(Excluding style related rules)

Many of these are node related rules (airbnb does not include any node rules)
Regardless of which style we are using, we may want to include more of the [Node rules].(https://github.com/mysticatea/eslint-plugin-node)
Most of the others are already in airbnb but not yet enabled, until eslint v7 is required (airbnb currently supports eslint v5, v6 or v7 now)

{
  'accessor-pairs': [ 'error', { setWithoutGet: true, enforceForClassMembers: true } ],
  'default-case-last': 'error',
  'no-useless-backreference': 'error',
  'no-extra-parens': [ 'error', 'functions' ],
  'no-import-assign': 'error',
  'no-loss-of-precision': 'error',
  'no-unmodified-loop-condition': 'error',
  'no-unreachable-loop': 'error',
  'no-useless-call': 'error',
  'prefer-regex-literals': [ 'error', { disallowRedundantWrapping: true } ],
  'node/handle-callback-err': [ 'error', '^(err|error)$' ],
  'node/no-callback-literal': 'error',
  'node/no-deprecated-api': 'error',
  'node/no-exports-assign': 'error',
  'node/no-new-require': 'error',
  'node/no-path-concat': 'error',
  'node/process-exit-as-throw': 'error',
  'promise/param-names': 'error'
}

Rules in airbnb but not in standard

(Excluding style related rules)

I tried to search for many of these rules in standard github issues, but I found no mentions.

{
  'block-scoped-var': 'error',
  'class-methods-use-this': [ 'error', { exceptMethods: [] } ],
  'consistent-return': 'error',
  'default-case': [ 'error', { commentPattern: '^no default$' } ],
  'guard-for-in': 'error',
  'max-classes-per-file': [ 'error', 1 ],
  'no-alert': 'warn',
  'no-else-return': [ 'error', { allowElseIf: false } ],
  'no-empty-function': [ 'error', { allow: [Array] } ],
  'no-extra-label': 'error',
  'no-loop-func': 'error',
  'no-param-reassign': [ 'error', { props: true, ignorePropertyModificationsFor: [Array] } ],
  'no-restricted-properties': [
    'error',
    {
      object: 'arguments',
      property: 'callee',
      message: 'arguments.callee is deprecated'
    },
    {
      object: 'global',
      property: 'isFinite',
      message: 'Please use Number.isFinite instead'
    },
    {
      object: 'self',
      property: 'isFinite',
      message: 'Please use Number.isFinite instead'
    },
    {
      object: 'window',
      property: 'isFinite',
      message: 'Please use Number.isFinite instead'
    },
    {
      object: 'global',
      property: 'isNaN',
      message: 'Please use Number.isNaN instead'
    },
    {
      object: 'self',
      property: 'isNaN',
      message: 'Please use Number.isNaN instead'
    },
    {
      object: 'window',
      property: 'isNaN',
      message: 'Please use Number.isNaN instead'
    },
    {
      property: '__defineGetter__',
      message: 'Please use Object.defineProperty instead.'
    },
    {
      property: '__defineSetter__',
      message: 'Please use Object.defineProperty instead.'
    },
    {
      object: 'Math',
      property: 'pow',
      message: 'Use the exponentiation operator (**) instead.'
    }
  ],
  'no-return-await': 'error',
  'no-script-url': 'error',
  'no-unused-labels': 'error',
  'no-useless-concat': 'error',
  radix: 'error',
  'vars-on-top': 'error',
  'for-direction': 'error',
  'getter-return': [ 'error', { allowImplicit: true } ],
  'no-await-in-loop': 'error',
  'no-console': 'warn',
  'no-extra-semi': 'error',
  'no-inner-declarations': 'error',
  'global-require': 'error',
  'no-buffer-constructor': 'error',
  'no-new-require': 'error',
  'no-path-concat': 'error',
  'no-label-var': 'error',
  'no-restricted-globals': [
    'error',
    {
      name: 'isFinite',
      message: 'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite'
    },
    {
      name: 'isNaN',
      message: 'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan'
    },
    'addEventListener',
    'blur',
    'close',
    'closed',
    'confirm',
    'defaultStatus',
    'defaultstatus',
    'event',
    'external',
    'find',
    'focus',
    'frameElement',
    'frames',
    'history',
    'innerHeight',
    'innerWidth',
    'length',
    'location',
    'locationbar',
    'menubar',
    'moveBy',
    'moveTo',
    'name',
    'onblur',
    'onerror',
    'onfocus',
    'onload',
    'onresize',
    'onunload',
    'open',
    'opener',
    'opera',
    'outerHeight',
    'outerWidth',
    'pageXOffset',
    'pageYOffset',
    'parent',
    'print',
    'removeEventListener',
    'resizeBy',
    'resizeTo',
    'screen',
    'screenLeft',
    'screenTop',
    'screenX',
    'screenY',
    'scroll',
    'scrollbars',
    'scrollBy',
    'scrollTo',
    'scrollX',
    'scrollY',
    'self',
    'status',
    'statusbar',
    'stop',
    'toolbar',
    'top'
  ],
  'no-shadow': 'error',
  'arrow-body-style': [ 'error', 'as-needed', { requireReturnForObjectLiteral: false } ],
  'arrow-parens': [ 'error', 'always' ],
  'no-confusing-arrow': [ 'error', { allowParens: true } ],
  'object-shorthand': [
    'error',
    'always',
    { ignoreConstructors: false, avoidQuotes: true }
  ],
  'prefer-arrow-callback': [ 'error', { allowNamedFunctions: false, allowUnboundThis: true } ],
  'prefer-destructuring': [
    'error',
    { VariableDeclarator: [Object], AssignmentExpression: [Object] },
    { enforceForRenamedProperties: false }
  ],
  'prefer-numeric-literals': 'error',
  'prefer-rest-params': 'error',
  'prefer-spread': 'error',
  'prefer-template': 'error',
  'require-yield': 'error',
  'import/no-unresolved': [ 'error', { commonjs: true, caseSensitive: true } ],
  'import/named': 'error',
  'import/no-named-as-default': 'error',
  'import/no-named-as-default-member': 'error',
  'import/no-extraneous-dependencies': [
    'error',
    { devDependencies: [Array], optionalDependencies: false }
  ],
  'import/no-mutable-exports': 'error',
  'import/no-amd': 'error',
  'import/extensions': [
    'error',
    'ignorePackages',
    { js: 'never', mjs: 'never', jsx: 'never' }
  ],
  'import/order': [ 'error', { groups: [Array] } ],
  'import/newline-after-import': 'error',
  'import/prefer-default-export': 'error',
  'import/no-dynamic-require': 'error',
  'import/no-self-import': 'error',
  'import/no-cycle': [ 'error', { maxDepth: '∞' } ],
  'import/no-useless-path-segments': [ 'error', { commonjs: true } ],
  strict: [ 'error', 'never' ]
}

Other

I also noticed the rule key-spacing is causing big commit diffs if just one line is changed.

'key-spacing': [

Transloadit + Vite: Error when importing the library

I'm working on a Vite App (Vue 3.x) that makes use of Transloadit for some operations with images/PDFs. I'm running into some errors when adding the Transloadit library (I'm creating my own plugin wrapping Transloadit).

I already solved an error caused by Vite removing process by adding this:

define: {
    'process.versions': process.versions
  }

to my vite.config.js.

The error I now get is:

Uncaught TypeError: Cannot read properties of undefined (reading 'Resolver')
    at node_modules/cacheable-lookup/source/index.js (index.js:7)
    at __require2 (chunk-IHTDASF6.js?v=e96a9976:17)
    at node_modules/got/dist/source/core/index.js (index.js:12)
    at __require2 (chunk-IHTDASF6.js?v=e96a9976:17)
    at node_modules/got/dist/source/as-promise/types.js (types.js:14)
    at __require2 (chunk-IHTDASF6.js?v=e96a9976:17)
    at node_modules/got/dist/source/as-promise/index.js (index.js:16)
    at __require2 (chunk-IHTDASF6.js?v=e96a9976:17)
    at node_modules/got/dist/source/create.js (create.js:15)
    at __require2 (chunk-IHTDASF6.js?v=e96a9976:17)

Expanding the browser stack trace I get:

node_modules/cacheable-lookup/source/index.js   @   index.js:7
__require2  @   chunk-IHTDASF6.js?v=e96a9976:17
node_modules/got/dist/source/core/index.js  @   index.js:12
__require2  @   chunk-IHTDASF6.js?v=e96a9976:17
node_modules/got/dist/source/as-promise/types.js    @   types.js:14
__require2  @   chunk-IHTDASF6.js?v=e96a9976:17
node_modules/got/dist/source/as-promise/index.js    @   index.js:16
__require2  @   chunk-IHTDASF6.js?v=e96a9976:17
node_modules/got/dist/source/create.js  @   create.js:15
__require2  @   chunk-IHTDASF6.js?v=e96a9976:17
node_modules/got/dist/source/index.js   @   index.js:14
__require2  @   chunk-IHTDASF6.js?v=e96a9976:17
node_modules/transloadit/src/Transloadit.js @   Transloadit.js:1
__require2  @   chunk-IHTDASF6.js?v=e96a9976:17
node_modules/transloadit/index.js   @   index.js:1
__require2  @   chunk-IHTDASF6.js?v=e96a9976:17
(anonymous) @   dep:transloadit:1

My dependencies:

"dependencies": {
    "@auth0/auth0-spa-js": "1.18.0",
    "axios": "0.21.2",
    "transloadit": "3.0.2",
    "vue": "3.2.12",
    "vue-router": "4"
  }

Is it possible to register a remote file on s3 with the node SDK client?

Hi guys,

Just wondering if it is possible to use the Node SDK to pipe a file that exists in an AWS S3 bucket?

TransloaditClient.addFile(name, path)
TransloaditClient.addStream(name, stream)

// potential public method
TransloaditClient.addURL(name, url)

Alternatively I was thinking the only option is to build a template (using the SDK) that calls the /s3/import robot API.

Any help appreciated, thanks!

CreateAssembly `fields` not utilized in assembly variables unless attached to params.

According to your documentation, createAssembly takes two parameters: params and fields.

TransloaditClient.createAssembly(options, cb)

Creates a new assembly on Transloadit, uploading all streams and files that were registered via .addStream() and .addFile() prior to the call to .createAssembly().

You can provide some options:

params - an object containing your template_id, notify_url, some steps that overwrite your Transloadit template and other params to control Transloadit behavior.
fields - an object of form fields to add to the request, to make use of in the assembly via assembly variables.

These fields are sent as multipart/form-data chunks, not as part of params.fields. Note that the REST API documentation does not specify either that it should be sent as part of params.fields, yet I only seem to be able to utilize the assembly variables ${fields.my_field_name} properties within my templates when I send them as params.fields.

This is quite confusing, and should be addressed both in the API and SDK documentation.

Typings file

Please include a typings file for typescript !

Build error!!!

W20210318-14:32:08.970(7)? (STDERR) return Number(process.hrtime.bigint() / 1000000n)
W20210318-14:32:08.970(7)? (STDERR) ^^^^^^^
W20210318-14:32:08.970(7)? (STDERR)
W20210318-14:32:08.971(7)? (STDERR) SyntaxError: Invalid or unexpected token
W20210318-14:32:08.971(7)? (STDERR) at createScript (vm.js:80:10)

Implement a `waitForAssembly` or similar

In pretty much every implementation that uses this node-sdk I'm seeing boilerplate like:

  newClient.createAssembly(options, (err, assemblyStatus) => {
    if (err) {
      return cb(err)
    }

    let iv = setInterval(() => {
      newClient.getAssembly(assemblyStatus.assembly_id, (err, assemblyStatus) => {
        if (err) {
          return cb(err)
        }

        if (_.get(assemblyStatus, 'ok') === 'ASSEMBLY_COMPLETED') {
          return cb(null, assemblyStatus)
        }

        if (_.has(assemblyStatus, 'error')) {
          return cb(new Error(assemblyStatus.error), assemblyStatus)
        }

        debug(`Waiting on: '${basename}' assembly_ssl_url=${assemblyStatus.assembly_ssl_url} ok=${assemblyStatus.ok} error=${assemblyStatus.error}`)
      })
    }, 1000)

Perhaps this polling could be moved into the SDK itself by means of a waitForAssembly method or similar?

Improvements

Potential improvements discovered during #87 but not blocking its merge:

  • github action slack notification like we had in travis
  • Use github releases with release notes instead of changelog. (I normally use np for publishing npm modules as it reduces chances of forgetting something)
  • disable travis builder
  • Option to auto-download results files (downloadResults: true) for createAssembly? I already created an example for this, but it could be a nice feature to be integrated in the API. Then we could even create a simple transloadit CLI that allows people to process local files using predefined templates for different useful operations!
  • allow specifying filename and contentType of uploaded streams? See form-data
    • Maybe merge the concept of filename and fieldname (it's a bit confusing)
  • Show off more cool things in readme (visual examples? gifs)
    • More files under examples/
  • Create types for all any fields in ts

Logs / Global Event Emitter

Could allow the user subscribe to:

  • Log events
  • onProgress event
  • (Suggested by kvz:) I think it would be nice if there was an option: reporter. By default it would be false. It could be set to nodesdk.consoleLogger or a custom function (progressCb add default console logger).
    Is this still needed now that we have the debug module for logging?

If we decide to add an EventEmitter it could lead to breaking changes (e.g. removing onUploadProgress and onAssemblyProgress from method options and move them to event listener)

Tests improvements

No longer do transpiling

I think we can launch a new major, setting a required engine in package.json, and then no longer doing any transpiling πŸ‘Œ

Error when using a non-file stream

transloadit.addStream('myfile', require('into-stream')('...')) errors with INVALID_FORM_DATA: The form contained bad data, which cannot be parsed. - works with fs.createReadStream, but not with other streams.

High Severity Vulnerability

High Insufficient Entropy

Package cryptiles

Patched in >=4.1.2

Dependency of transloadit

Path transloadit > request > hawk > cryptiles

Cannot find module 'request'

Hello there!

I'm trying to use Transloadit in my React project and I have the next error message when I require transloadit:
image

What I did:

  • installed transloadit by npm install --save transloadit
  • added TransloaditClient = require('transloadit') to one of my components
  • tried to compile and I've got the error.

my setup:

What am I doing wrong?

TypeError: Not a Buffer

Every now and then I seem to get stuck with this error? Not sure where the problem lies:

16:12:23 web.1  | TypeError: Not a buffer
16:12:23 web.1  |   at new Hmac (crypto.js:257:17)
16:12:23 web.1  |   at Object.Hmac (crypto.js:255:12)
16:12:23 web.1  |   at TransloaditClient.calcSignature (~/Projects/keystone/node_modules/transloadit/lib/TransloaditClient.js:228:21)
16:12:23 web.1  |   at TransloaditClient._appendForm (~/Projects/keystone/node_modules/transloadit/lib/TransloaditClient.js:234:24)
16:12:23 web.1  |   at TransloaditClient._remoteJson (~/Projects/keystone/node_modules/transloadit/lib/TransloaditClient.js:407:21)
16:12:23 web.1  |   at ~/Projects/keystone/node_modules/transloadit/lib/TransloaditClient.js:51:24
16:12:23 web.1  |   at ~/Projects/keystone/node_modules/transloadit/lib/TransloaditClient.js:281:20
16:12:23 web.1  |   at Request._callback (~/Projects/keystone/node_modules/transloadit/lib/TransloaditClient.js:404:16)
16:12:23 web.1  |   at Request.self.callback (~/Projects/keystone/node_modules/transloadit/node_modules/request/index.js:142:22)
16:12:23 web.1  |   at Request.emit (events.js:98:17)
16:12:23 web.1  |   at Request.<anonymous> (~/Projects/keystone/node_modules/transloadit/node_modules/request/index.js:856:14)
16:12:23 web.1  |   at Request.emit (events.js:117:20)
16:12:23 web.1  |   at IncomingMessage.<anonymous> (~/Projects/keystone/node_modules/transloadit/node_modules/request/index.js:808:12)
16:12:23 web.1  |   at IncomingMessage.emit (events.js:117:20)
16:12:23 web.1  |   at _stream_readable.js:943:16
16:12:23 web.1  |   at process._tickCallback (node.js:419:13)
16:12:23 web.1  | 17 Nov 16:12:23 - [nodemon] app crashed - waiting for file changes before starting...

Unable to pass `request` upload

If you set { upload: { file: request('some-url') } } (with the request library), then this error happens:

/home/julian/dev/transloadit/node-sdk/node_modules/into-stream/index.js:74
		const chunk = input.slice(0, size);
		                    ^

TypeError: input.slice is not a function
    at Class.reader [as _from] (/home/julian/dev/transloadit/node-sdk/node_modules/into-stream/index.js:74:23)
    at Class._read (/home/julian/dev/transloadit/node-sdk/node_modules/from2/index.js:68:10)
    at Class.Readable.read (/home/julian/dev/transloadit/node-sdk/node_modules/readable-stream/lib/_stream_readable.js:443:10)
    at resume_ (/home/julian/dev/transloadit/node-sdk/node_modules/readable-stream/lib/_stream_readable.js:790:12)

Are we missing an is undefined check?

Just got:

/Users/kvz/code/content/node_modules/transloadit/lib/TransloaditClient.js:588
        var body = _ref5.body,
                        ^

TypeError: Cannot read property 'body' of undefined
    at Request._callback (/Users/kvz/code/content/node_modules/transloadit/lib/TransloaditClient.js:588:25)
    at self.callback (/Users/kvz/code/content/node_modules/transloadit/node_modules/request/request.js:187:22)
    at emitOne (events.js:115:13)
    at Request.emit (events.js:210:7)
    at Timeout._onTimeout (/Users/kvz/code/content/node_modules/transloadit/node_modules/request/request.js:762:12)
    at ontimeout (timers.js:488:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:283:5)

Only got the transpiled code:

So that seems another issue, we don't ship working sourcemaps right now.

Patched around it via:

        if (err) {
          return cb(err);
        }

        if (!_ref5) {
          return cb(new Error('No data for request!'));
        }

        var body = _ref5.body,
            statusCode = _ref5.statusCode;

for now.

Unclear error message

When I create a Template, I get:

HTTPError: Response code 400 (Bad Request)
    at Request.<anonymous> (/Users/kvz/code/node-sdk/node_modules/got/dist/source/as-promise/index.js:119:42)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1682966317401,
    socket: 1682966317401,
    lookup: 1682966317401,
    connect: 1682966317401,
    secureConnect: 1682966317401,
    upload: 1682966317402,
    response: 1682966317806,
    end: 1682966317807,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 0,
      dns: 0,
      tcp: 0,
      tls: 0,
      request: 1,
      firstByte: 404,
      download: 1,
      total: 406
    }
  },
  transloaditErrorCode: 'TEMPLATE_VALIDATION_ERROR'
}

When I edit node_modules/got/dist/source/as-promise/index.js by hand and also output the response, there are more useful things in the response that we do not bubble up to the user, such as:

  body: {
    error: 'TEMPLATE_VALIDATION_ERROR',
    message: `Invalid Template name "node-sdk-test1": please choose another Template name, one of your other Templates was named 'node-sdk-test1' previously.`,
    http_code: 400
  },

It would be great to also have this message in our errors instead of just ERR_NON_2XX_3XX_RESPONSE TEMPLATE_VALIDATION_ERROR

Adding a file that doesn't exist causes assembly to hang/never complete

If calling "addFile()" and passing a path that does not exist, when calling "createAssembly()" the process will appear to hang. The assembly in Transloadit gets stuck on "Uploading".

I believe this is because the file gets read as a stream, which waits for input that never comes.

Code to reproduce:

return new Promise((resolve, reject) => {
    const transloadit = new TransloaditClient({
        authKey: config.transloadit.clientId,
        authSecret: config.transloadit.clientSecret
    });

    transloadit.addFile("myimage", "/nonexistingfile.mp4");

    var options = {
        params: {
            steps: {
                "android_video": {
                    "use": ":original",
                    "robot": "/video/encode",
                    "result": true,
                    "ffmpeg_stack": "v2.2.3",
                    "preset": "android"
                }
            }
        }
    };
    transloadit.createAssembly(options, function(err, result) {
        if (err) {
            reject(err);
        }

        console.log(result);
        resolve();
    });
});

Make it more apparent if CloudFlare tunnels fail

Currently CloudFlare is having issues

image

And this causes the test server to hang. Jest kicks in with a:

Timeout - Async callback was not invoked within the 10000 ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 10000 ms timeout specified by jest.setTimeout.Error:

Otherwise there is no sign of trouble

createAssembly callback issue with v2.0.0

Hi team,

I am experiencing an issue in v2.0.0 with the createAssembly method:

transloaditClient.createAssembly({ params }, (err, result) => {
  // This is not reachable
})

I am not having the callback triggered at all for failed or successful assemblies (verified in my transloadit web dashboard). I have tried with waitForCompletion set to true but the issue persists. params is an arbitrary basic import -> resize image -> export steps

Downgrading to v1.10.3 which I was using previously and re-running the code worked as expected with error and results respectively.

Apologies if this is something I am doing wrong, but seems odd that it works with no code change from me in a previous version.

SSL secured API communication

As far as I can see the default protocol for API communication is http and not https. Does this have any reason? It would be great if it would be possible to be able to configure https usage.

If you don't have objections I would create a pull request for this feature.

Improved TUS support

Improve error debuggability

if i make a mistake updating a Template that in fact does not exist, i only see:

HTTPError: Response code 400 (Bad Request)
    at Request.<anonymous> (node_modules/got/dist/source/as-promise/index.js:118:42)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1671710227500,
    socket: 1671710227501,
    lookup: 1671710227501,
    connect: 1671710227537,
    secureConnect: 1671710227581,
    upload: 1671710227582,
    response: 1671710227789,
    end: 1671710227790,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 1,
      dns: 0,
      tcp: 36,
      tls: 44,
      request: 1,
      firstByte: 207,
      download: 1,
      total: 290
    }
  },
  transloaditErrorCode: 'TEMPLATE_VALIDATION_ERROR'
}

I don’t know why it failed.

Yet if i code node_modules/transloadit/ to manually dump the body when this happens, I can see the API does reveal more about the nature of my fail:

{
  body: {
    error: 'TEMPLATE_VALIDATION_ERROR',
    message: "Invalid id/name: A Template with id/name 'xyz' doesn't exist for this app.",
    http_code: 400
  }
}

TLDR: would be cool to add body.message to the error that the consuming dev sees.

Deprecate np for releases

It does not support yarn 4, and has no plans to support it either. Meanwhile, i find 4 is a massive speed boost. It's so fast on subsequent runs that i can now have it run automatically which is a game changer.

We'd need a different convenience script to do releases (or fork np if that's easier idk), and document that in the README.md

For now i reverted yarn from 4 to 1 again

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.