Skip to content

window.__TAURI__.invoke() throws "_this.transformCallback is not a function" #1547

@edbrannin

Description

@edbrannin

Describe the bug

Whenever I call window.__TAURI__.invoke(), I get this error:

_this.transformCallback is not a function. (In '_this.transformCallback(function (r) {
        resolve(r);
        delete window[error];
      }, true)', '_this.transformCallback' is undefined)

To Reproduce

Code:

  1. Make a custom command
  2. Run that command with window.__TAURI__.invoke() (see also line 4)

Runnable example:

  1. Clone https://github.com/edbrannin/multi-diff (at commit: 70a8f04a78ef8e0effc0052ea98077c0be1c2bb8)
  2. Run yarn tauri dev

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Platform and Versions (please complete the following information):

Operating System - Mac OS, version 10.15.7 X64

Node.js environment
  Node.js - 12.20.1
  @tauri-apps/cli - 1.0.0-beta-rc.2
  @tauri-apps/api - 1.0.0

Global packages
  npm - 6.14.11
  yarn - 1.22.10

Rust environment
  rustc - 1.51.0
  cargo - 1.51.0

App directory structure
/node_modules
/public
/src-tauri
/build
/.git
/src

App
  tauri.rs - 1.0.0-beta-rc.0
build-type - bundle
CSP - default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'
distDir - ../build
devPath - http://localhost:3000

Additional context

I've been using window.__TAURI__.invoke() because of #1512 -- I'll try using the imported version now that rc2 is out.

Stack Trace

[Error] Error:
TypeError: _this.transformCallback is not a function. (In '_this.transformCallback(function (r) { resolve(r); delete window[error]; }, true)', '_this.transformCallback' is undefined)
user-script:3:101:45
Promise
invoke — user-script:3:100
(anonymous function) — App.js:48
asyncFunctionResume
(anonymous function) — App.js:30
asyncFunctionResume
(anonymous function) — App.js:41
invokePassiveEffectCreate — react-dom.development.js:23487
callCallback — react-dom.development.js:3945
dispatchEvent
invokeGuardedCallbackDev — react-dom.development.js:3994
invokeGuardedCallback — react-dom.development.js:4056
flushPassiveEffectsImpl — react-dom.development.js:23574
unstable_runWithPriority — scheduler.development.js:468
(anonymous function) — react-dom.development.js:23324
workLoop — scheduler.development.js:417
flushWork — scheduler.development.js:390
performWorkUntilDeadline — scheduler.development.js:157
	(anonymous function) (main.chunk.js:86)
	asyncFunctionResume
	(anonymous function)
	promiseReactionJobWithoutPromise
	promiseReactionJob

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions