Custom-coded-action: Merge contacts that share the same phone number

We are working on using the custom-coded-action “Merge contacts that share the same phone number” however when we try and use the code we are receiving the following error message. Does anyone have any ideas on what we’re doing wrong?

WARNING: The logs for this function have exceeded the 4KB limit.
...
ngth\":\"316\",\"content-type\":\"application/json;charset=utf-8\",\"date\":\"Tue, 09 May 2023 13:37:09 GMT\",\"nel\":\"{\\\"success_fraction\\\":0.01,\\\"report_to\\\":\\\"cf-nel\\\",\\\"max_age\\\":604800}\",\"report-to\":\"{\\\"endpoints\\\":[{\\\"url\\\":\\\"https:\\\\/\\\\/a.nel.cloudflare.com\\\\/report\\\\/v3?s=AoQcSh%2BH5KWQpzgws3ks9CEQbHhIfvrvmDb5RqQQPkxJw6%2Bjqk6P4oHxXEEPs3JPqQtbiWQWE068mOQQWJ2qKs0T343RV26smKKgBH%2Fple%2FF4S47WDmQ%2FMQTpELWV0oi\\\"}],\\\"group\\\":\\\"cf-nel\\\",\\\"max_age\\\":604800}\",\"server\":\"cloudflare\",\"strict-transport-security\":\"max-age=31536000; includeSubDomains; preload\",\"vary\":\"origin, Accept-Encoding\",\"x-envoy-upstream-service-time\":\"3\",\"x-evy-trace-listener\":\"listener_https\",\"x-evy-trace-route-configuration\":\"listener_https/all\",\"x-evy-trace-route-service-name\":\"envoyset-translator\",\"x-evy-trace-served-by-pod\":\"iad02/hubapi-td/envoy-proxy-5677b5b686-nr69t\",\"x-evy-trace-virtual-host\":\"all\",\"x-hubspot-auth-failure\":\"401 Unauthorized\",\"x-hubspot-correlation-id\":\"98c75a82-5862-403d-b08b-d365f55dfd60\",\"x-request-id\":\"5bab5413-bf26-4744-a129-724d0c263177\",\"x-trace\":\"2B633DFCFA065BAC628DA848157B468B920A4632ED000000000000000000\"}"," at BasicApiResponseProcessor.<anonymous> (/opt/nodejs/node_modules/@hubspot/api-client/lib/codegen/crm/contacts/apis/BasicApi.js:247:23)"," at Generator.next (<anonymous>)"," at fulfilled (/opt/nodejs/node_modules/@hubspot/api-client/lib/codegen/crm/contacts/apis/BasicApi.js:5:58)"," at processTicksAndRejections (node:internal/process/task_queues:96:5)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: HTTP-Code: 401","Message: An error occurred.","Body: {\"status\":\"error\",\"message\":\"Authentication credentials not found. This API supports both API Key and OAuth 2.0 authentication and you can find more details at https://developers.hubspot.com/docs/methods/auth/oauth-overview\",\"correlationId\":\"98c75a82-5862-403d-b08b-d365f55dfd60\",\"category\":\"INVALID_AUTHENTICATION\"}","Headers: {\"access-control-allow-credentials\":\"false\",\"alt-svc\":\"h3=\\\":443\\\"; ma=86400, h3-29=\\\":443\\\"; ma=86400\",\"cf-cache-status\":\"DYNAMIC\",\"cf-ray\":\"7c4a55e4de5413b3-IAD\",\"connection\":\"close\",\"content-length\":\"316\",\"content-type\":\"application/json;charset=utf-8\",\"date\":\"Tue, 09 May 2023 13:37:09 GMT\",\"nel\":\"{\\\"success_fraction\\\":0.01,\\\"report_to\\\":\\\"cf-nel\\\",\\\"max_age\\\":604800}\",\"report-to\":\"{\\\"endpoints\\\":[{\\\"url\\\":\\\"https:\\\\/\\\\/a.nel.cloudflare.com\\\\/report\\\\/v3?s=AoQcSh%2BH5KWQpzgws3ks9CEQbHhIfvrvmDb5RqQQPkxJw6%2Bjqk6P4oHxXEEPs3JPqQtbiWQWE068mOQQWJ2qKs0T343RV26smKKgBH%2Fple%2FF4S47WDmQ%2FMQTpELWV0oi\\\"}],\\\"group\\\":\\\"cf-nel\\\",\\\"max_age\\\":604800}\",\"server\":\"cloudflare\",\"strict-transport-security\":\"max-age=31536000; includeSubDomains; preload\",\"vary\":\"origin, Accept-Encoding\",\"x-envoy-upstream-service-time\":\"3\",\"x-evy-trace-listener\":\"listener_https\",\"x-evy-trace-route-configuration\":\"listener_https/all\",\"x-evy-trace-route-service-name\":\"envoyset-translator\",\"x-evy-trace-served-by-pod\":\"iad02/hubapi-td/envoy-proxy-5677b5b686-nr69t\",\"x-evy-trace-virtual-host\":\"all\",\"x-hubspot-auth-failure\":\"401 Unauthorized\",\"x-hubspot-correlation-id\":\"98c75a82-5862-403d-b08b-d365f55dfd60\",\"x-request-id\":\"5bab5413-bf26-4744-a129-724d0c263177\",\"x-trace\":\"2B633DFCFA065BAC628DA848157B468B920A4632ED000000000000000000\"}"," at process.<anonymous> (file:///var/runtime/index.mjs:1189:17)"," at process.emit (node:events:513:28)"," at emit (node:internal/process/promises:140:20)"," at processPromiseRejections (node:internal/process/promises:274:27)"," at processTicksAndRejections (node:internal/process/task_queues:97:32)"]}
Unknown application error occurred
Runtime.Unknown

Memory: 25/128 MB
Runtime: 1449.04 ms

Hi @AWeil :waving_hand: Did you manage to resolve the issue?

If not, I’ve been looking into the error message you shared, and here’s what I’ve found:

The error message indicates a “401 Unauthorized” status. It states, “Authentication credentials not found. This API supports both API Key and OAuth 2.0 authentication”. You can find more details about this at Accounts Dashboard | HubSpot

This usually occurs when the authentication credentials are either incorrect or not provided at all.

As a first step, I would recommend checking the authentication method you’re using. Verify your API Key or OAuth 2.0 credentials to ensure they’re correct and are being included in your request as required.

I hope this helps!

Best,
Jaycee