0

I'm trying to bulk load data by hitting the neptune bulk load endpoint:

  private void upload(String source) throws URISyntaxException, IOException {
    String jsonReq = createJson("s3://" + source);
    InputStream inputStream = new ByteArrayInputStream(jsonReq.getBytes(StandardCharsets.UTF_8));

    Request<Void> req = new DefaultRequest<>("neptune-db");
    req.setHttpMethod(HttpMethodName.POST);
    req.setEndpoint(new URI("https", null, HOST, 8182, "/loader", null, null));
    req.setContent(inputStream);
    req.setHeaders(Map.of("host",
        HOST,
        "Content-Type",
        "application/json",
        "x-amz-content-sha256",
        "required"));

    AWS4Signer signer = new AWS4Signer();
    signer.setRegionName(region);
    signer.setServiceName(req.getServiceName());
    signer.setOverrideDate(new Date());
    signer.sign(req, getCreds());

    httpClient.requestExecutionBuilder().request(req).errorResponseHandler(new ErrorResponseHandler()).execute();
  }

I keep getting 403. The same request works in AWScurl and postman. What could be missing in this case? I can see the tokens getting pulled for the signing.

Ryan
  • 1,102
  • 1
  • 15
  • 30

1 Answers1

1

For those who ran into this... https://github.com/aws/amazon-neptune-sigv4-signer/blob/863025d2426115231dd473fa33399cf1dd166cf1/src/main/java/com/amazonaws/neptune/auth/NeptuneApacheHttpSigV4Signer.java#L46

This comment on their neptunesigv4 code mentions double host headers will break it. Which it did. I removed my extra host header.

Ryan
  • 1,102
  • 1
  • 15
  • 30