top of page
Forum Posts
Roger Argueta
Dec 10, 2020
In Coding with Velo
Hello! it's Wed 9, 2020 18:17 -06GMT and suddenly getItem and setItem stop working on Live pages. It only works in Developer mode / Sandbox. I know this, because some pages I wasn't working on, stopped working. I have tried in Chrome, Safari, and nothing. Thanks for the support! Roger.
0
3
28
Roger Argueta
Nov 10, 2020
In Coding with Velo
Hi everyone! I'm having a little problem with an Button_click event. The problem is that it is called two times, and it makes my code run two times. What is the difference in the call: Well, this button is located inside a "REPEATER", so I'm using the following code to get the Button_click event: export function bBoton_click(event, $w) { //my code is here } Just to be clear, I use de "$w" as a parameter, in order to get the value of that specific item selected in the repeater. And when I see the content of the "event" parameter, it is the same content or information, so there is no differences in both instances called by 1 button pressed. See the content of the "event" parameter in the files attached (each one contains the "event" content of each run) So that's it!!! Thanks for your help!!!
0
0
15
Roger Argueta
Nov 10, 2020
In Coding with Velo
Hi! I'm having a new error in a backend function I have since many months ago. I have stopped receiving notifications, and right now I'm checking the code and found that when I call this "wixCrm.notifications.notify" it came with a bunch of errors displayed on the console log. My function is: import wixCrm from 'wix-crm-backend';
export function notifyNewSignature(pTitle,pDesc,pActionTitle,pURL,pRole) {
wixCrm.notifications.notify(
pDesc,
["Browser","Dashboard","Mobile"],
{
"title": pTitle,
"actionTitle": pActionTitle,
"actionTarget": {"url": pURL},
"recipients": { "role": pRole} //"Owner" "All_Contributors"
}
);
//console.log("Backend: NotificarMessage enviado")
} The errors I'm getting are these (displayed on Console Log): Unhandled rejection TypeError: logger.debug is not a function at /dynamic-modules/edm_root/3d049220-22ca-11eb-b9ec-a16ccc5e7368/node_modules/@wix/wix-crm-backend/src/notifications/api.ts:26:10 at Generator.next (<anonymous>) at /dynamic-modules/edm_root/3d049220-22ca-11eb-b9ec-a16ccc5e7368/node_modules/@wix/wix-crm-backend/dist/src/notifications/api.js:8:71 at Promise._execute (/elementory/node_modules/bluebird/js/release/debuggability.js:384:9) at Promise._resolveFromExecutor (/elementory/node_modules/bluebird/js/release/promise.js:518:18) at new Promise (/elementory/node_modules/bluebird/js/release/promise.js:103:10) at __awaiter (/dynamic-modules/edm_root/3d049220-22ca-11eb-b9ec-a16ccc5e7368/node_modules/@wix/wix-crm-backend/dist/src/notifications/api.js:4:12) at Object.exports.notify (/dynamic-modules/edm_root/3d049220-22ca-11eb-b9ec-a16ccc5e7368/node_modules/@wix/wix-crm-backend/src/notifications/api.ts:25:5) at notifyNewSignature (/user-code/backend/notifications.jsw:4:24) at webMethodWrapper (/elementory/src/js-server-side/web-module-extension.js:39:33) at /elementory/node_modules/wix-error-boundaries/dist/index.js:11:23 at FunctionExecutor._run (/elementory/node_modules/@wix/cloud-runtime-core/lib/processors/AbstractFunctionExecutor.js:18:26) at FunctionExecutor._execute (/elementory/node_modules/@wix/cloud-runtime-core/lib/processors/FunctionExecutor.js:21:45) at /elementory/node_modules/@wix/cloud-runtime-core/lib/processors/AbstractFunctionExecutor.js:11:12 at /elementory/node_modules/@wix/cloud-monitoring-js/index.js:298:22 at FunctionExecutor.execute (/elementory/node_modules/@wix/cloud-runtime-core/lib/processors/AbstractFunctionExecutor.js:10:85) at /elementory/node_modules/@wix/cloud-runtime-core/lib/RuntimeProcessor.js:54:34 at /elementory/node_modules/@wix/cloud-monitoring-js/index.js:298:22 at /elementory/node_modules/@wix/cloud-runtime-core/lib/RuntimeProcessor.js:53:64 at RuntimeEnvironment.withEnv (/elementory/node_modules/@wix/cloud-runtime-core/lib/RuntimeEnvironment.js:23:28) at RuntimeProcessor.process (/elementory/node_modules/@wix/cloud-runtime-core/lib/RuntimeProcessor.js:35:31) at handler (/elementory/src/handlers/web-methods/index.js:74:8) at Layer.handle [as handle_request] (/elementory/node_modules/express/lib/router/layer.js:95:5) at next (/elementory/node_modules/express/lib/router/route.js:137:13) at webMethodRouteValidator (/elementory/src/handlers/web-methods/index.js:39:14) at Layer.handle [as handle_request] (/elementory/node_modules/express/lib/router/layer.js:95:5) at next (/elementory/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/elementory/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/elementory/node_modules/express/lib/router/layer.js:95:5) at /elementory/node_modules/express/lib/router/index.js:281:22 at param (/elementory/node_modules/express/lib/router/index.js:354:14) at param (/elementory/node_modules/express/lib/router/index.js:365:14) at param (/elementory/node_modules/express/lib/router/index.js:365:14) at param (/elementory/node_modules/express/lib/router/index.js:365:14)
0
5
62
Roger Argueta
Oct 08, 2020
In Coding with Velo
Hello everyone! I have a log with more than 20,000 records, and I would like to purge al the records, but I don't know how to do this. Also, I need to maintain the collection in order to keep logging new records. Thank you.
0
1
107
Roger Argueta
Oct 07, 2020
In Coding with Velo
Hello! I need to use WebHook in order to receive real time information from a provider (ClassMarker.com) for an "online-course-exam-tracking" purpose. The code that I need to run is shown below (provided by the provided with nice documentation in this link: https://www.classmarker.com/online-testing/api/webhooks/ ), but my only one error is the line #1, that results to relate to a "package" reserved word (see image of the error). I've been reading the forum and found in this post (https://support.wix.com/en/article/corvid-working-with-npm-packages) some information about "nmp packages" that frankly I'm not sure if it's the same thing, but presuming that IT IS the same thing, I tried to search in NPM PACKAGE library to found my provider (ClassMarker.com) with no results; So this is my question and request: How can I make this work, and if something has to be formally requested for "evaluation" in order to add this package to the approved nmp package list, How should I proceed? thanks a lot for your help. package com.classmarker.webhook;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import java.util.Date;
import java.util.Objects;
import java.util.Enumeration;
import java.util.stream.Collectors;
import java.util.Base64;
@WebServlet("/webhook")
public class WebhookServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException {
// You are given a uniquе secret code when crеating a Wеbhook.
String classmarkerSecretPhrase = "YOUR_CLASSMARKER_WEBHOOK_SECRET_PHRASE";
String jsonStringPayload = httpServletRequest.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
String headerHmacSignature = httpServletRequest.getHeader("x-classmarker-hmac-sha256");
boolean isVerifiedSuccessfully = false;
try {
isVerifiedSuccessfully = verifyWebhook(jsonStringPayload, headerHmacSignature, classmarkerSecretPhrase);
} catch (InvalidKeyException | NoSuchAlgorithmException exception) {
// handle еxception hеre
}
if (isVerifiedSuccessfully) {
saveToFile("json_data_" + new Date() + ".json", jsonStringPayload);
// Notify ClassMarker you have rеceived the Wеbhook.
httpServletResponse.setStatus(HttpServletResponse.SC_OK);
}
else{
httpServletResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
}
private boolean verifyWebhook(String jsonData, String headerHmacSignature, String classmarkerSecretPhrase) throws InvalidKeyException, NoSuchAlgorithmException {
byte[] hashHMacBytes = hashHMac(jsonData, classmarkerSecretPhrase);
String calculatedSignature = Base64.getEncoder().encodeToString(hashHMacBytes);
return Objects.equals(headerHmacSignature, calculatedSignature);
}
private byte[] hashHMac(String sourceString, String key) throws InvalidKeyException, NoSuchAlgorithmException {
String HMAC_SHA256 = "HmacSHA256";
Mac sha512HMAC = Mac.getInstance(HMAC_SHA256);
byte[] keyBytes = key.getBytes(StandardCharsets.US_ASCII);
SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, HMAC_SHA256);
sha512HMAC.init(secretKeySpec);
return sha512HMAC.doFinal(sourceString.getBytes(StandardCharsets.US_ASCII));
}
private void saveToFile(String fileName, String content) throws IOException {
File file = new File(fileName);
FileOutputStream fileOutputStream = new FileOutputStream(file);
// If filе doesn't еxists, then crеate it.
if (!file.exists()) {
file.createNewFile();
}
fileOutputStream.write(content.getBytes());
fileOutputStream.flush();
fileOutputStream.close();
}
}
$w.onReady(function () {
// TODO: write your page related code here...
});
0
3
54
Roger Argueta
Oct 07, 2020
In Coding with Velo
I have more than 6 months trying to answer this question, and honestly my only help have been the forum, by the way, great answers and quick solutions. Now I have a specific request to make, and still not knowing where to ask for "Priority Help" as offered in the VIP Wix Site Plan.
0
0
12
Roger Argueta
More actions
bottom of page