# About Custom Code

**URL:** <https://community.hubspot.com/t/about-custom-code/81813>\
**Category:** APIs & Integrations\
**Tags:** professional\
**Created:** [May 23, 2023, 3:57pm UTC](https://community.hubspot.com/t/about-custom-code/81813 "2023-05-23T15:57:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SAMsan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/samsan/32/17908_2.png) [@SAMsan](https://community.hubspot.com/u/SAMsan)\
**Post date:** [May 23, 2023, 3:57pm UTC](https://community.hubspot.com/t/about-custom-code/81813/1 "2023-05-23T15:57:21Z")

</div>

Hello,

I’m strugling with custom code blocks, wondering if there’s any limitation that could be related to my issue, knowing this search returns 2 matching results on Postman.  
I’m trying to get deals with this search query:

`let myFilters =[{ propertyName: "dealstage", operator: "EQ", value: `${dealStage}`},{ propertyName: "associations.contact", operator: "EQ", value: `${contactId}`}];// Get all deals for this contact or returnlet deals = hubspotClient.crm.contacts.searchApi.doSearch({filterGroups: [{filters: myFilters}] }) .then((response) => { console.log( response.total ); })`

Here is the resulting error log:

```auto
WARNING: The logs for this function have exceeded the 4KB limit.
...
IC\",\"cf-ray\":\"7cbe4b6429be2d0b-IAD\",\"connection\":\"close\",\"content-length\":\"123\",\"content-type\":\"application/json;charset=utf-8\",\"date\":\"Tue, 23 May 2023 15:22:28 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=5Ay%2Fc1Tr3MJRht7TykYA7B0%2BNvB7cb0bjY9LOFbUX2VKZlt6YCUtNrWMaUPZvGoohh5VCnmm34v2LeXHrOGes7t5cnul2zaR%2FMaS2eOXuQ%2FJRv7Sj6P%2F8owwst2LgblA\\\"}],\\\"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\":\"142\",\"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-598c95b5b7-vk5c8\",\"x-evy-trace-virtual-host\":\"all\",\"x-hubspot-correlation-id\":\"c70f4345-5b27-4449-87f7-f28751624478\",\"x-hubspot-ratelimit-daily\":\"500000\",\"x-hubspot-ratelimit-daily-remaining\":\"488248\",\"x-request-id\":\"4a42f223-df0b-4f16-ba48-3255ef8e8264\",\"x-trace\":\"2B79D33B70A50AAD3E7CCE0D04EF4B2B5ECDA3C8CB000000000000000000\"}"," at SearchApiResponseProcessor.<anonymous> (/opt/nodejs/node_modules/@hubspot/api-client/lib/codegen/crm/contacts/apis/SearchApi.js:63:23)"," at Generator.next (<anonymous>)"," at fulfilled (/opt/nodejs/node_modules/@hubspot/api-client/lib/codegen/crm/contacts/apis/SearchApi.js:5:58)"," at processTicksAndRejections (node:internal/process/task_queues:96:5)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: HTTP-Code: 400","Message: An error occurred.","Body: {\"status\":\"error\",\"message\":\"There was a problem with the request.\",\"correlationId\":\"c70f4345-5b27-4449-87f7-f28751624478\"}","Headers: {\"access-control-allow-credentials\":\"false\",\"alt-svc\":\"h3=\\\":443\\\"; ma=86400, h3-29=\\\":443\\\"; ma=86400\",\"cf-cache-status\":\"DYNAMIC\",\"cf-ray\":\"7cbe4b6429be2d0b-IAD\",\"connection\":\"close\",\"content-length\":\"123\",\"content-type\":\"application/json;charset=utf-8\",\"date\":\"Tue, 23 May 2023 15:22:28 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=5Ay%2Fc1Tr3MJRht7TykYA7B0%2BNvB7cb0bjY9LOFbUX2VKZlt6YCUtNrWMaUPZvGoohh5VCnmm34v2LeXHrOGes7t5cnul2zaR%2FMaS2eOXuQ%2FJRv7Sj6P%2F8owwst2LgblA\\\"}],\\\"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\":\"142\",\"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-598c95b5b7-vk5c8\",\"x-evy-trace-virtual-host\":\"all\",\"x-hubspot-correlation-id\":\"c70f4345-5b27-4449-87f7-f28751624478\",\"x-hubspot-ratelimit-daily\":\"500000\",\"x-hubspot-ratelimit-daily-remaining\":\"488248\",\"x-request-id\":\"4a42f223-df0b-4f16-ba48-3255ef8e8264\",\"x-trace\":\"2B79D33B70A50AAD3E7CCE0D04EF4B2B5ECDA3C8CB000000000000000000\"}"," 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: 79/128 MB
Runtime: 2750.20 ms

```

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [May 24, 2023, 6:54pm UTC](https://community.hubspot.com/t/about-custom-code/81813/2 "2023-05-24T18:54:06Z")

</div>

Hey, @SAMsan 👋 Thanks for your question! I have some questions that will help the community better understand your project and its goal(s).

- Have you tried converting the `dealStage` and `contactId` variables to strings? Something like this?`value: `${dealStage.toString()}``
- Since it works in Postman, can you share your request and request body from Postman here?
- Are you hardcoding `dealStage` and `contactId` in your Postman request?

Thank you! — Jaycee

---

<div class="post-metadata">

**Author:** ![SAMsan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/samsan/32/17908_2.png) [@SAMsan](https://community.hubspot.com/u/SAMsan)\
**Post date:** [May 25, 2023, 7:37am UTC](https://community.hubspot.com/t/about-custom-code/81813/3 "2023-05-25T07:37:08Z")

</div>

OK, my bad, searching the crm.contacts with a deal query will never work…

`// Get all deals for this contact or returnlet deals = hubspotClient.crm.contacts.searchApi.doSearch({filterGroups: [{filters: myFilters}] })`

Thank you [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074) for your time!
