Hello team!
Testing the below Lambda yields the following error:
undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"getaddrinfo ENOTFOUND https://db-simplify-mvp-dev-instance-1.cwezylrm9ic8.us-east-1.neptune.amazonaws.com:8182","code":"ENOTFOUND","errno":-3008,"syscall":"getaddrinfo","hostname":"https://db-simplify-mvp-dev-instance-1.cwezylrm9ic8.us-east-1.neptune.amazonaws.com:8182","stack":["Error: getaddrinfo ENOTFOUND https://db-simplify-mvp-dev-instance-1.cwezylrm9ic8.us-east-1.neptune.amazonaws.com:8182"," at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)"]}
I also tried with the Writer endpoint: db-simplify-mvp-dev.cluster-cwezylrm9ic8.us-east-1.neptune.amazonaws.com
- same error.
I also tried with and without the https:// prefix in the host and hostname - same error.
This is the Lambda code:
import { HttpRequest} from "@aws-sdk/protocol-http";
import { defaultProvider } from "@aws-sdk/credential-provider-node";
import { NodeHttpHandler } from "@aws-sdk/node-http-handler";
import { SignatureV4 } from '@aws-sdk/signature-v4';
import { Sha256 } from '@aws-crypto/sha256-js';
var request = new HttpRequest({
body: JSON.stringify({"query":"MATCH+%28n%29+RETURN+n+LIMIT+1"}),
headers: {
'Content-Type': 'application/json',
'host': `https://db-simplify-mvp-dev-instance-1.cwezylrm9ic8.us-east-1.neptune.amazonaws.com:8182`
},
hostname: `https://db-simplify-mvp-dev-instance-1.cwezylrm9ic8.us-east-1.neptune.amazonaws.com:8182`,
method: 'POST',
path: '/openCypher'
});
var signer = new SignatureV4({
credentials: defaultProvider(),
region: 'us-east-1',
service: 'neptune-db',
sha256: Sha256
});
const signedRequest = await signer.sign(request);
// Send the request
var client = new NodeHttpHandler();
var { response } = await client.handle(signedRequest);
console.log(response.statusCode + ' ' + response.body.statusMessage);
var responseBody = '';
await new Promise(() => {
response.body.on('data', (chunk) => {
responseBody += chunk;
});
response.body.on('end', () => {
console.log('Response body: ' + responseBody);
});
}).catch((error) => {
console.log('Error: ' + error);
});
This is a **NodeJS 18 Runtime **Lambda.
Lambda execution role has these policies:
AmazonEC2FullAccess
NeptuneFullAccess
AWSLambdaBasicExecutionRole
AmazonSSMReadOnlyAccess
AWSLambdaVPCAccessExecutionRole
VPC Configuration is:
Neptune Instance is available and configured:
The Neptune Security Group has inbound rules to allow the Lambda Security Group on port 8182:
Please point me to where I'm missing anything.
Thank you!
Mor
Does the Security Group assigned to Neptune allow traffic on port 8182 from the security group that you assigned to your Lambda function?
You also may need to remove
https://
from the hostname and host parameters of your HttpRequest.Thank you, Taylor! Yes, I tried with and without https:// and I added an image of the Neptune SG inbound rules, hope that is cleared for traffic.