Generate Billing handlers is not defined

Alternatives
New Member
9 0 0

We setup a basic shopify (node) app using the CLI as instructed. Then ran the "shopify generate billing" and selected a recurring billing cycle. When we serve the app it compiles fine but when we go to install it we are met with a referenceError: handlers is not defined (see below). Why are we running into this error and how do we resolve it? 

 

(node:43028) ExperimentalWarning: The fs.promises API is experimental

event - compiled successfully

> Ready on http://localhost:8081

  ReferenceError: handlers is not defined

      at _callee$ (/Users/user/Public/Sites/shopifyapp/server/server.js:37:28)

      at tryCatch (/Users/user/Public/Sites/shopifyapp/node_modules/@babel/polyfill/node_modules/regenerator-runtime/runtime.js:63:40)

      at Generator.invoke [as _invoke] (/Users/user/Public/Sites/shopifyapp/node_modules/@babel/polyfill/node_modules/regenerator-runtime/runtime.js:293:22)

      at Generator.next (/Users/user/Public/Sites/shopifyapp/node_modules/@babel/polyfill/node_modules/regenerator-runtime/runtime.js:118:21)

      at asyncGeneratorStep (/Users/juserred/Public/Sites/shopifyapp/server/server.js:29:103)

      at _next (/Users/user/Public/Sites/shopifyapp/server/server.js:31:194)

      at /Users/jausered/Public/Sites/shopifyapp/server/server.js:31:364

      at new Promise (<anonymous>)

      at /Users/jared/Public/Sites/shopily/server/server.js:31:97

      at afterAuth (/Users/jared/Public/Sites/shopily/server/server.js:37:28)

 

0 Likes
Alternatives
New Member
9 0 0

Just to follow up on this, we can successfully create billing when we go through the react billing setup. It's more of a question of should the CLI setup just work without having to go through that? Is there something missing in the docs or the generation of the billing?

0 Likes
Dgeodev
Shopify Partner
26 2 8

The shopify generate billing doesn't seem to work properly anymore...

add in server.js this: 

import * as handlers from "./handlers/index";
 
and in afterAuth this
 
const { shop, accessToken } = ctx.session;
Cordialement,
Dgeo Dev
scole954387
Excursionist
15 1 7

Thanks for this!  Is there a tutorial that you're aware of that walked us through knowing how to set this up now that generate billing has been removed?

It seems odd that the Shopify CLI still creates the index.js file and the mutation when creating the app but doesn't give any tutorials or anything on how to use it.  I'm fairly new to programming and finding it a huge struggle just to find some good examples that still works.

The redirect to choose a plan works now however I am looking to provide an option for the merchant to see a choice of plans and select the one that best suites their needs.  Do you have any examples of this or know where I can find a good tutorial for it?

Thanks! 

0 Likes