Error with SendInvoice after publish

Hello
I been trying to send invoice when the form is filled in.
So used a backend code with webmodulepermission set to anyone.

I tried in preview it worked but after publishing it doesn’t work.

"["Unhandled rejection Error: {\"message\":\"{\\\"message\\\":\\\"required permissions are missing: Permission(wix-quotes,manage)\\\",\\\"details\\\":{}}\"}\n at Object.<anonymous> (/dynamic-modules/edm_root/f6f76e40-2780-11eb-8afd-51123b6dec93/node_modules/@wix/wix-billing-backend/src/server-api.ts:40:11)\n at Generator.throw (<anonymous>)\n at rejected (/dynamic-modules/edm_root/f6f76e40-2780-11eb-8afd-51123b6dec93/node_modules/@wix/wix-billing-backend/dist/src/server-api.js:5:65)\n at bound (domain.js:420:14)\n at runBound (domain.js:433:12)\n at tryCatcher (/elementory/node_modules/bluebird/js/release/util.js:16:23)\n at Promise._settlePromiseFromHandler (/elementory/node_modules/bluebird/js/release/promise.js:547:31)\n at Promise._settlePromise (/elementory/node_modules/bluebird/js/release/promise.js:604:18)\n at Promise._settlePromise0 (/elementory/node_modules/bluebird/js/release/promise.js:649:10)\n at Promise._settlePromises (/elementory/node_modules/bluebird/js/release/promise.js:725:18)\n at _drainQueueStep (/elementory/node_modules/bluebird/js/release/async.js:93:12)\n at _drainQueue (/elementory/node_modules/bluebird/js/release/async.js:86:9)\n at Async._drainQueues (/elementory/node_modules/bluebird/js/release/async.js:102:5)\n at Immediate.Async.drainQueues [as _onImmediate] (/elementory/node_modules/bluebird/js/release/async.js:15:14)\n at processImmediate (internal/timers.js:439:21)\n at process.topLevelDomainCallback (domain.js:131:23)"]"

I got this error logged in Site Events, looks like missing permission because it works in Preview.
Cant find anything in the help documentation about this.

howdy, have you (or anyone else) solved this? Running into the same issue whenever I try to call

  • priceQuote.sendPriceQuote(idAndVersion, emailInfo);

Like you, I have permissions set to Anyone. I have no problems creating the quote, and have tried to move where .sendPriceQuote() gets called multiple times.

under createPriceQuote call

in event.js under onPriceQuoteCreated

and it’s own backend function call

I workaround this way, to send invoices you need to be valid authenticated user. So login as admin user and call backend code.

wixUsers.login(“username”, “password”)
.then( (sessionToken) => {
callbackend(param1, param2)
.then(() => {
//wixUsers.logout();
});

@mkiruba Thanks for the reply! I am still having the same problem tho. Did you use wixUsers on a Code Page, or a backend file? Have tried a couple combinations.

Aka, were you using
import wixUsers from ‘wix-users’;

or

import wixUsersBackend from ‘wix-users-backend’;

Also, the user you are signing in as is a Site Member I presume, with Admin privilege

I’ve just had the same problem with Invoices, adding suppressAuth helped even though it shows as an error:

return invoices.sendInvoice(idandVer, emailInfo, {suppressAuth:true})
1 Like

Does this work?

You have added { suppressAuth : true } is the invoice sent but the error still displayed?

By the docs , sendInvoice() does not support suppressAuth.

Only createInvoicePreviewUrl( ) can do that.

Does it help?

@certified-code It does work, I had an issue yesterday of normal members accounts not being able to recieve invoices, added in the suppressAuth and it’s now working and marks the invoice as sent.

It does show as an error in the code panel but doesn’t show the permission error in the console anymore and works.

Thanks for the clarification, @luke73917 !

Same problem, I’m successfully creating price quote using .createPriceQuote function, but when I try to use .sendPriceQuote, the console log throws a Permission error.

Please help me out.