Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: use buffer instead of btoa

Brad Barbinabeafb3b7097
diff --git a/apps/erp/app/integrations/onshape/lib/client.ts b/apps/erp/app/integrations/onshape/lib/client.ts
index a2ed841042..d0210816e1 100644
--- a/apps/erp/app/integrations/onshape/lib/client.ts
+++ b/apps/erp/app/integrations/onshape/lib/client.ts
@@ -31,7 +31,9 @@ export class OnshapeClient {
return {
"Content-Type": "application/json",
Accept: "application/json;charset=UTF-8; qs=0.09",
- Authorization: `Basic ${btoa(`${this.accessKey}:${this.secretKey}`)}`,
+ Authorization: `Basic ${Buffer.from(
+ `${this.accessKey}:${this.secretKey}`
+ ).toString("base64")}`,
};
}
@@ -54,6 +56,7 @@ export class OnshapeClient {
if (!response.ok) {
const errorText = await response.text();
+ console.log("Onshape API error headers:", headers);
throw new Error(`Onshape API error (${response.status}): ${errorText}`);
}