Describe the problem/error/question
Hi all, Another simili No0b here. Hope you can help me with this bblocker.
An HTTP Request to GET a contact by email in an Hubspot org fails even though the email is available in the Node Input data and the expression returns the correct value when building the workflow. The node executes tests correctly without outputing data (already a red flag) and then it turns that dreadful red and “undefined” at all real life executions though.
What am I doing wrong?
I believe the issue is in the expression included in the url to dynamically populate the email part inside this endpoint url (as per: Hubspot: Get Contact by email API endpoint).
For example for my use case I tried https://api.hubapi.com/contacts/v1/contact/email/{{ $node[‘Filter for Italy’].json.email }}/profile (based on the ouput of the node straight prior to this one) and https://api.hubapi.com/contacts/v1/contact/email/{{ $node[‘Listen to AB Form Submission in WSE INT Hubspot’].json.email }}/profile (based on the initial webhook trigger node which starts the workflow when a form is submitted). They both have the email in the data.
Important to say that when I test this endpoint url in Postman by putting an email address that exists in the org, I do get a result. This is also a testing method I tried on the node to no avail (it “executed successfully” without outputting data).
Another info is that the credentials to authenticate the request I use is the bearer token of a Private Auth App in the org. I checked it was still valid and it works in other similar requests via Zapier and Postman.
What is the error message (if any)?
ERROR: Method not allowed - please check you are using the right HTTP method
Error 405 Method Not Allowed HTTP ERROR 405
Reason: Method Not Allowed
And the full thing:
{“status”:“rejected”,“reason”:{“message”:“Method not allowed - please check you are using the right HTTP method”,“timestamp”:1685697383558,“name”:“NodeApiError”,“description”:“\n\n<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>\nError 405 Method Not Allowed\n\n
HTTP ERROR 405
\nReason:\n
Method Not Allowed\n\n\n”,“context”:{},“cause”:{“message”:“405 - "\n\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/>\nError 405 Method Not Allowed\n\n
HTTP ERROR 405
\nReason:\n
Method Not Allowed\n\n\n"”,“name”:“Error”,“stack”:“Error: 405 - "\n\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/>\nError 405 Method Not Allowed\n\n
HTTP ERROR 405
\nReason:\n
Method Not Allowed\n\n\n"\n at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n at RedirectableRequest.handleResponse (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:238:9)\n at RedirectableRequest.emit (node:events:525:35)\n at RedirectableRequest.emit (node:domain:489:12)\n at RedirectableRequest._processResponse (/usr/local/lib/node_modules/n8n/node_modules/follow-redirects/index.js:356:10)\n at ClientRequest.RedirectableRequest._onNativeResponse (/usr/local/lib/node_modules/n8n/node_modules/follow-redirects/index.js:62:10)\n at Object.onceWrapper (node:events:628:26)\n at ClientRequest.emit (node:events:525:35)\n at ClientRequest.emit (node:domain:489:12)\n at HTTPParser.parserOnIncomingClient (node:_http_client:693:27)\n at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)\n at TLSSocket.socketOnData (node:_http_client:534:22)\n at TLSSocket.emit (node:events:513:28)\n at TLSSocket.emit (node:domain:489:12)\n at addChunk (node:internal/streams/readable:315:12)\n at readableAddChunk (node:internal/streams/readable:289:9)\n at TLSSocket.Readable.push (node:internal/streams/readable:228:10)\n at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)\n at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17)”}}}
Please share your workflow
Share the output returned by the last node
When testing the node on its own: output = nothing, even though the endpoint url seems correc. I tested both by inputting an email address that exists in the Hubspot org and via the method I want to use i.e have a enpoint url with the “contact email” section populating dynamically thanks to an expression returning the email that is part of the output of the very first node or that of the one just prior to my request. Both “succeed” as tests without ouputting anything (I want the contact’s vid/hs_object_id returned at the very least).
When testing via an execution of the workflow through mock submitting a form: the expression suddenly returns “undefined” meaning the endpoint url becomes
https://api.hubapi.com/contacts/v1/contact/email//profile and the output is then the error mentioned above
Information on your n8n setup
- n8n version: 0.228.2 (Latest Stable)
- Database (default: SQLite):: Default I believe
- n8n EXECUTIONS_PROCESS setting (default: own, main): Default I believe
- **Running n8n via n8n cloud
- **Operating system: Microstoft Windows 10 Pro 64-bit operating system, x64-based processor