Giovanni Cocco
Giovanni Cocco
BBuildShip
Created by Angel Mayr on 4/17/2024 in #❓・buildship-help
whatsapp-trigger - >Error: error validating signature
The entire code. Cc @Gaurav Chadha @Wimukthi import parser from "co-body"; import typeis from "type-is"; import crypto from 'crypto'; const mimeTypes = { json: [ "application/json", "application/json-patch+json", "application/vnd.api+json", "application/csp-report", "application/reports+json", "application/scim+json", ], form: ["application/x-www-form-urlencoded"], text: ["text/plain"], xml: ["text/xml", "application/xml"], }; function isTypes(contentTypeValue, types) { if (typeof contentTypeValue === "string") { contentTypeValue = contentTypeValue.replace(/;$/, ""); } return typeis.is(contentTypeValue, types); } function validate_signature(rawData, hmac_header, accessSecret) { const hmacReceived = hmac_header.replace('sha256=', ''); const json_string = rawData.normalize('NFC'); // NFC Standardization const digest = crypto.createHmac('sha256', accessSecret).update(json_string).digest('hex'); const resp = crypto.timingSafeEqual( Buffer.from(hmacReceived, 'hex'), Buffer.from(digest, 'hex') ); console.log(validate_signature: ${resp}); return resp; } async function onExecution({ app_id, accessSecret }, { nodeReq, request, res, logging }) { try { logging.log(onExecution); const rawBody = await parser.text(nodeReq); // Read raw body as string const sig = request.headers['x-hub-signature-256']; logging.log("sig", sig); const valid = validate_signature(rawBody, sig, accessSecret); logging.log("valid", valid); if (!valid) { throw new Error("error validating signature"); } return { request: { headers: request.headers, body: JSON.parse(rawBody), }, output: {} }; } catch (error) { logging.log(error); throw new Error(error: ${error}); } } export default { onCreate: async () => ({ success: true }), onUpdate: async () => ({ success: true }), onExecution };
27 replies
BBuildShip
Created by Angel Mayr on 4/17/2024 in #❓・buildship-help
whatsapp-trigger - >Error: error validating signature
Hi guys! cc @Gaurav Chadha @Wimukthi I modified this two lines: const json_string = rawData.normalize('NFC'); // NFC Standardization const rawBody = await parser.text(nodeReq); // Read raw body as string
27 replies
BBuildShip
Created by Angel Mayr on 4/17/2024 in #❓・buildship-help
whatsapp-trigger - >Error: error validating signature
@Gaurav Chadha Solved!
27 replies
BBuildShip
Created by Angel Mayr on 4/17/2024 in #❓・buildship-help
whatsapp-trigger - >Error: error validating signature
I think the problem is here right? // validate signature function validate_signature(data, hmac_header, accessSecret) { const json_string = JSON.stringify(data); const hmacReceived = hmac_header.replace('sha256=', ''); const digest = crypto.createHmac('sha256', accessSecret).update(json_string).digest('hex'); const resp = crypto.timingSafeEqual(Buffer.from(hmacReceived, 'hex'), Buffer.from(digest, 'hex')); console.log(validate_signature: ${resp}) return resp; }
27 replies
BBuildShip
Created by Angel Mayr on 4/17/2024 in #❓・buildship-help
whatsapp-trigger - >Error: error validating signature
@Gaurav Chadha Any update about this fix?
27 replies
BBuildShip
Created by Angel Mayr on 4/17/2024 in #❓・buildship-help
whatsapp-trigger - >Error: error validating signature
Ok my workflow is back! Just waiting the fix/updated from WhatsApp trigger!
27 replies
BBuildShip
Created by tom on 11/14/2024 in #💬・general
tom - Seems my migration to v2 failed. I'm rath...
@Gaurav Chadha I am getting failed to shipping workflow! I opened in-app support!
15 replies
BBuildShip
Created by Angel Mayr on 4/17/2024 in #❓・buildship-help
whatsapp-trigger - >Error: error validating signature
Hi @Gaurav Chadha any news about this error?
27 replies
BBuildShip
Created by Angel Mayr on 4/17/2024 in #❓・buildship-help
whatsapp-trigger - >Error: error validating signature
Thanks @Gaurav Chadha I will wait!
27 replies
BBuildShip
Created by Angel Mayr on 4/17/2024 in #❓・buildship-help
whatsapp-trigger - >Error: error validating signature
Hi everyone! I'm getting this or the same error, but what's causing it are the words with accents. If I send the same message without accents it works. Can help?
27 replies
BBuildShip
Created by Giovanni Cocco on 11/6/2024 in #💬・general
Giovanni Cocco - Hi everyone! Why some message...
I'm writing in Brazilian Portuguese so there are a lot of accents.
3 replies
BBuildShip
Created by Giovanni Cocco on 11/6/2024 in #💬・general
Giovanni Cocco - Hi everyone! Why some message...
I understood the error but I don't know how to adjust it. Whenever I send a message with an accent, the error is returned, if I write without an accent it works.
3 replies
BBuildShip
Created by Giovanni Cocco on 11/6/2024 in #💬・general
Giovanni Cocco - Hi everyone! Why some message...
The meta token is valid, some messages I got reply and some does not.
3 replies
BBuildShip
Created by Giovanni Cocco on 9/21/2024 in #💬・general
Giovanni Cocco - Hi everyone! Is it possible SS...
It wasn't clear how to do this using Buildship, but it was very easy to do using Pipedream. Thanks!
3 replies
BBuildShip
Created by Giovanni Cocco on 9/18/2024 in #💬・general
Giovanni Cocco - Hi everyone! I have a problem ...
Thanks!
6 replies
BBuildShip
Created by Giovanni Cocco on 9/18/2024 in #💬・general
Giovanni Cocco - Hi everyone! I have a problem ...
I got!
6 replies
BBuildShip
Created by Giovanni Cocco on 9/18/2024 in #💬・general
Giovanni Cocco - Hi everyone! I have a problem ...
@Gaurav Chadha here is the doc https://docs.asaas.com/reference/create-new-customer Yes the dollar sign is part of the api key. I tried without $ using Postman and I got 401 (Unauthorized). I tried the same thing on Buildship hoping to get a 401 error and determine that the problem is the dollar sign, but I got the same error as before. Unexpected token '<', "<!doctype "... is not valid JSON
6 replies
BBuildShip
Created by Giovanni Cocco on 9/18/2024 in #💬・general
Giovanni Cocco - Hi everyone! I have a problem ...
I even created a new, simpler node with just the POST method for testing and still got the same error. import fetch from 'node-fetch'; export default async function callApiPostMethod({ url, access_token, name, cpfCnpj, email, mobilePhone }) { const requestBody = { name, cpfCnpj, email, mobilePhone }; const response = await fetch(url, { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Access_token': access_token }, body: JSON.stringify(requestBody) }); const data = await response.json(); return data; }
6 replies