Here’s the code snippet in text:
// backend/newsletter.web.js
import { Permissions, webMethod } from ‘wix-web-module’;
import { elevate } from ‘wix-auth’;
import { emailSubscriptions } from ‘@wix/email-subscriptions’;
export const subscribeToNewsletter = webMethod(
Permissions.Anyone,
**async** (email) => {
**const** elevatedUpsert = elevate(
emailSubscriptions.upsertEmailSubscription
);
**try** {
**const** result = **await** elevatedUpsert({
subscription: {
email: email,
subscriptionStatus: "SUBSCRIBED"
}
});
console.log("✅ Newsletter subscribed:", email);
**return** {
success: **true**,
result
};
} **catch** (error) {
console.error("❌ Newsletter Fehler:", email);
console.error(JSON.stringify(error, **null**, 2));
**return** {
success: **false**,
error
};
}
}
);
// --------------------------
// Newsletter Subscription
// --------------------------
**const** formData = otpEntry.formData;
**if** (formData.newsletter && formData.email) {
**try** {
console.log("⏳ Warte vor Newsletter Subscription...");
**await** **new** Promise(resolve =>
setTimeout(resolve, 3000)
);
console.log("📧 Starte Newsletter Subscription...");
**const** newsletterResult =
**await** subscribeToNewsletter(formData.email);
console.log("📧 Newsletter Result:");
console.log(JSON.stringify(newsletterResult));
} **catch** (newsletterError) {
console.error("❌ Newsletter Subscription Fehler:");
console.error(newsletterError);
}
}
The flow I want to achieve is to update the email subscription status in my CRM via velo code. I use an individual form for the registration of new users and there is a checkbox in the UI for whether accepting or declining the newsletter. I’ve tried to execute the code with a hard coded variant and without the forwarding it to the other backend-module. So isolated from anything and it worked but as I try it with the actual registration flow it keeps failing in the newsletter.web.js (so not in the other module where it gets forwarded) with the error code 403. As you can see in my code I use elevate and webMethod as well but I keep getting the error.
If you wanna have a look on my error log:
2026-05-14 13:07:15.012
Newsletter Fehler: dakex95300@ellbit.com
{
insertId: “…EE8Qq58Px4AQameJjvaJR4”
jsonPayload: {
message: “
Newsletter Fehler: dakex95300@ellbit.com”
serviceContext: {2}
}
labels: {6}
logName: “projects/wix-managed-50fbc8b9/logs/8f845f30-b949-4904-a236-e4971ea5abd7”
operation: {2}
receiveTimestamp: “2026-05-14T11:07:16.343962820Z”
resource: {2}
severity: “ERROR”
sourceLocation: {
file: “backend/newsletter.web.js”
line: “33”
}
timestamp: “2026-05-14T11:07:15.012000083Z”
}
2026-05-14 13:07:15.013
{
“response”: {
“data”: {
“details”: {
“applicationError”: {
“description”: “”,
“code”: 403,
“data”: {
“requestId”: “1778756834.7891700823511335”,
“details”: {
“message”: “”,
“details”: {}
}
}
}
},
“message”: “”
},
“status”: 403
},
“requestId”: “1778756834.7891700823511335”,
“details”: {
“applicationError”: {
“description”: “”,
“code”: 403,
“data”: {
“requestId”: “1778756834.7891700823511335”,
“details”: {
“message”: “”,
“details”: {}
}
}
},
“requestId”: “1778756834.7891700823511335”
},
“status”: 403,
“message”: “{\n \“message\”: \”\“,\n \“details\”: {\n \“applicationError\”: {\n \“description\”: \”\“,\n \“code\”: 403,\n \“data\”: {\n \“requestId\”: \“1778756834.7891700823511335\”,\n \“details\”: {\n \“message\”: \”\“,\n \“details\”: {}\n }\n }\n },\n \“requestId\”: \“1778756834.7891700823511335\”\n }\n}”
}
Thanks for your help in advance.