Best answer

Trigger in REST mode, using subscribe operation in code mode fails with api is undefined

  • 15 August 2020
  • 2 replies
  • 417 views

Userlevel 1

When I create a Trigger in REST mode and configure my subscribe operation in Form Mode, the test succeeds. However when switching to Code Mode and without making any changes, I receive the following error message:

 

api is not defined What happened (You are seeing this because you are an admin): Executing triggers.new_bitcom_transaction.operation.performUnsubscribe with bundle api is not defined Console logs: Stack trace: ReferenceError: api is not defined at eval (eval at makeFunction (/var/task/node_modules/zapier-platform-core/src/tools/schema-tools.js:7:30), <anonymous>:9:36) at execute (/var/task/node_modules/zapier-platform-core/src/execute.js:78:12) at input (/var/task/node_modules/zapier-platform-core/src/create-command-handler.js:29:14) at Object.beforeMiddleware.then.newInput (/var/task/node_modules/zapier-platform-core/src/middleware.js:90:22) at bound (domain.js:402:14) at Object.runBound (domain.js:415:12) at Object.tryCatcher (/var/task/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/var/task/node_modules/bluebird/js/release/promise.js:517:31) at Promise._settlePromise (/var/task/node_modules/bluebird/js/release/promise.js:574:18) at Promise._settlePromise0 (/var/task/node_modules/bluebird/js/release/promise.js:619:10) at Promise._settlePromises (/var/task/node_modules/bluebird/js/release/promise.js:699:18) at _drainQueueStep (/var/task/node_modules/bluebird/js/release/async.js:138:12) at _drainQueue (/var/task/node_modules/bluebird/js/release/async.js:131:9) at Async._drainQueues (/var/task/node_modules/bluebird/js/release/async.js:147:5) at Immediate.Async.drainQueues [as _onImmediate] (/var/task/node_modules/bluebird/js/release/async.js:17:14) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5) at processImmediate (timers.js:658:5) at process.topLevelDomainCallback (domain.js:126:23)

 

 
icon

Best answer by Kyrt 17 August 2020, 21:14

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +9

It looks like that error is actually coming from the unsubscribe request rather than the subscribe.

 

It looks testing by configuring a real Zap in the Zap editor, which is great! If so, the Zap editor in the test step will actually call subscribe to create a subscription, and then unsubscribe to clean up.  This is to validate that everything’s going to work when the user actually turns the Zap on.  (The performList is also called to get samples.)  I’m wondering if perhaps the unsubscribe is getting called when you weren’t expecting it to? 

 

The Monitoring section in the developer UI is a great place to see the entire transaction and all the requests made to spot what’s going on.

Userlevel 1

It looks like that error is actually coming from the unsubscribe request rather than the subscribe.

 

 

That’s correct. In my post I explained that this error happened on the subscribe operation, but it also happens on the unsubsribe operation. The same error ‘api is undefined’ happens on every operation I test when Code Mode is used. For now, I’m working around the issue by not using code mode and reformatting the incoming request on my end.