You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code is timing out in connection with the neptune endpoint.
// first the configuration preparation:constgetHostAndPort=(writeFlag:boolean) :any=>{varresult:any={};if(writeFlag){result={host: process.env.NEPTUNE_WRITE_HOSTNAME,port: process.env.NEPTUNE_WRITE_PORT,url: "https://"+process.env.NEPTUNE_WRITE_ADDRESS+"/sparql",};}else{result={host: process.env.NEPTUNE_READ_HOSTNAME,port: process.env.NEPTUNE_READ_PORT,url: "https://"+process.env.NEPTUNE_READ_ADDRESS+"/sparql",};}constfetchHeaders=newHeaders();fetchHeaders.append('host',result.host+":"+result.port);constfetcherOptions : ISparqlEndpointFetcherArgs={method: 'POST',defaultHeaders: fetchHeaders,fetch: async(url:any,init:any)=>{console.log("fetch-1: ",url,init);// this is comingconstr=awaitfetch(url,init);// this is not returningconsole.log("fetch-2: ",r);// as this is never printed out.returnr;},prefixVariableQuestionMark: true,timeout: 5000,};result.fetcherOptions=fetcherOptions;returnresult;}// routine to execute the query.consta_runQuery=async(query:string,writeFlag:boolean=false) :Promise<any>=>{consturlParam : any=getHostAndPort(writeFlag);try{constmyFetcher : SparqlEndpointFetcher=newSparqlEndpointFetcher(urlParam.fetcherOptions);console.log("a_runQuery-1",query,urlParam);if(writeFlag){if(myFetcher.getUpdateTypes(query)==='UNKNOWN'){returnformatResponse(null,500,"GQ0002","invalid update format",undefined,[query]);}awaitmyFetcher.fetchUpdate(urlParam.url,PREFIX+query);// not tested yet.}else{varresultStream : any;switch(myFetcher.getQueryType(PREFIX+query)){default:
case"UNKNOWN":
returnformatResponse(null,500,"GQ0002","invalid query format",undefined,[query]);case"SELECT":
console.log("a_runQuery-2a",query,urlParam.url);resultStream=awaitmyFetcher.fetchBindings(urlParam.url,PREFIX+query);// it is timing outbreak;case"ASK":
constanswer=awaitmyFetcher.fetchAsk(urlParam.url,PREFIX+query);returnformatResponse(answer,200,"","",undefined,[query]);case"CONSTRUCT":
resultStream=awaitmyFetcher.fetchTriples(urlParam.url,PREFIX_QUERY+query);break;}console.log("a_runQuery-3",resultStream);constpromise=newPromise((resolve,reject)=>{varresult :any[]=[];resultStream.on('data',(chunk:any)=>result.push(chunk));resultStream.on('end',(chunk:any)=>{console.log("a_runQuery-4",result);resolve(formatResponse(result,200,"","",undefined,[query]));});});returnawaitpromise;}}catch(e){returnformatResponse(null,500,"GQ0001","Fatal Query Error",e,[query]);}}
With the old code (AWS sdk for javascript V2, getting out of support end of 2023!) it is currently working, with that I have fixed also some connection issues in the VPC configuration with the help of the AWS support.
The log output at the console.log fetch-1 from above looks l like:
My working solution is an out dated example with the AWS SDK for javascript V2. the sd v2 is out of suppot end of the year, so I want to have a differnt connection and also the comfort of this fetch library.
The following code is timing out in connection with the neptune endpoint.
With the old code (AWS sdk for javascript V2, getting out of support end of 2023!) it is currently working, with that I have fixed also some connection issues in the VPC configuration with the help of the AWS support.
The log output at the console.log fetch-1 from above looks l like:
I found some hints in the Neptune manual from AWS.
I have also a log for an header request with the old code, maybe that may help in finding the solution:
The text was updated successfully, but these errors were encountered: