Support Questions
Find answers, ask questions, and share your expertise

Could not find HTTP response object for this identifier

Could not find HTTP response object for this identifier

New Contributor

I am using the below Nifi processors

HandleHttpRequest -> RouteOnAttribute -> HandleHttpResponse

My RouteOnAttribute property is test and value is ${http.headers.type:contains('test')}

nifi_error.JPG

Below is the sample client request which i sent to nifi server and i am getting response code as 200 same i have mentioned in HandleHttpResponse's http status code which means my configured the processor correctly

import requests
import json
import traceback

nifi_url = "http://localhost:8009/report"


def uploadLogs(fileName):
f = open(fileName, 'rb')
payload = {
"this": "that"
}

files = {'info': (None, json.dumps(payload), 'application/json; charset=utf-8'),
'file': ('current', f, "text/plain; charset=us-ascii")}
headers = {'type': 'test', "Keep-Alive": "timeout=100", "Content-Transfer-Encoding": "8bit",
"Connection": "Keep-Alive"}
url = ''

try:
url = nifi_url
response = requests.post(url, files=files, headers=headers)
print(response.status_code)
if (response != None and (response.status_code == 200 or response.status_code == 201)):
return True
except:
traceback.print_exc()
return False

filename = "C:\\sample.txt"
print(uploadLogs(filename))

 Still i am getting below error i would like to know is this error expected if not why i am getting below error and how to fix this error. Any help is appreciated

 

nifi_1 | 2020-11-13 19:14:09,360 ERROR [Timer-Driven Process Thread-7] o.a.n.p.standard.HandleHttpResponse HandleHttpResponse[id=39d755ed-f825-3013-ce47-5218721d27d4] Failed to respond to HTTP request for StandardFlowFileRecord[uuid=1a422f48-41e3-4eb9-9390-73b12762c5dc,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1605269814303-549, container=default, section=549], offset=39642, length=16],offset=0,name=1a422f48-41e3-4eb9-9390-73b12762c5dc,size=16] because FlowFile had an 'http.context.identifier' attribute of 5e7dc338-8684-491d-a554-6392e2a0e3b9 but could not find an HTTP Response Object for this identifier

4 REPLIES 4

Re: Could not find HTTP response object for this identifier

@manas_mandal786 

 

I sometimes see these errors when a long amount of time is spent testing within the flow from the handhttprequest through to the handlehttpresponse.  You no longer have an active connection to the original requesting client.  If you test the flow entirely with a single request do you still get the error?

Re: Could not find HTTP response object for this identifier

New Contributor

@stevenmatison 

for me it always comes , regarding " If you test the flow entirely with a single request do you still get the error?" do you mean single request instead of multipart-form data? Is there any way i can fix the active connection to the original request?

Re: Could not find HTTP response object for this identifier

New Contributor

I have attched nifi configuration file in this url https://www.dropbox.com/s/dyvxduepz94vwct/simple_request_response_template.xml?dl=0 please check and let me know any issue in configuration settings

Re: Could not find HTTP response object for this identifier

@manas_mandal786  Thanks for providing template.  The next thing I wanted to look at was configs so you read my mind.   I was able to import your template, start the context service, and add success/failure routes for each test to an output port (so i can see results are success/fail).  With the workflow setup I execute 2 curl calls:

 

curl -L -X POST 'http://localhost:8009/report' -H 'Content-Type: multipart/form-data' -F test=test
curl -L -X POST 'http://localhost:8009/report' -H 'Content-Type: multipart/form-data' -H 'ReportType: test' -F test=test

 

And my canvas looks like this:

 

Screen Shot 2020-11-16 at 12.25.05 PM.png

 

I did not get any warnings.  Everything worked as expected.  If you are still getting issues,  i suspect it is something to do with your environment (windows) not being able to store the metadata for the StandardSSLContext Service. This store will hold the client connection until you send the response.  In your case that part does not seem to be working.   Look for any errors/warnings in nifi-app.log while testing.  You may see warnings in the Controller Services window on the StandardSSLContext.   You may need to set each processor to DEBUG in order to find more info in the nifi-app.log.