acm19 / aws-request-signing-apache-interceptor

https://acm19.github.io/aws-request-signing-apache-interceptor/
Apache License 2.0
16 stars 6 forks source link

{"error":"no handler found for uri [/index_name/type_name/document_id] and method [POST]"} #91

Closed dblock closed 1 year ago

dblock commented 1 year ago

Samples are written for OpenSearch 1.x. For 2.x you get an error.

$ REGION=us-west-2 ENDPOINT=https://....us-west-2.es.amazonaws.com/ make run_sample
Picked up JAVA_TOOL_OPTIONS: -Dlog4j2.formatMsgNoLookups=true
[INFO] Scanning for projects...
[INFO] 
[INFO] -------< io.github.acm19:aws-request-signing-apache-interceptor >-------
[INFO] Building AWS Request Signing Apache Interceptor 2.2.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ aws-request-signing-apache-interceptor ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/dblock/source/opensearch-project/aws-request-signing-apache-interceptor/dblock-aws-request-signing-apache-interceptor/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ aws-request-signing-apache-interceptor ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ aws-request-signing-apache-interceptor ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ aws-request-signing-apache-interceptor ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- exec-maven-plugin:3.1.0:java (default-cli) @ aws-request-signing-apache-interceptor ---
2023/01/06 15:53:55:749 EST [DEBUG] wire - http-outgoing-0 >> "GET / HTTP/1.1[\r][\n]"
2023/01/06 15:53:55:754 EST [DEBUG] wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
2023/01/06 15:53:55:754 EST [DEBUG] wire - http-outgoing-0 >> "Authorization: AWS4-HMAC-SHA256 ..."
2023/01/06 15:53:55:754 EST [DEBUG] wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
2023/01/06 15:53:55:754 EST [DEBUG] wire - http-outgoing-0 >> "Host: ....us-west-2.es.amazonaws.com[\r][\n]"
2023/01/06 15:53:55:754 EST [DEBUG] wire - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.14 (Java/19.0.1)[\r][\n]"
2023/01/06 15:53:55:754 EST [DEBUG] wire - http-outgoing-0 >> "X-Amz-Date: 20230106T205355Z[\r][\n]"
2023/01/06 15:53:55:754 EST [DEBUG] wire - http-outgoing-0 >> "X-Amz-Security-Token: ..."
2023/01/06 15:53:55:754 EST [DEBUG] wire - http-outgoing-0 >> "[\r][\n]"
2023/01/06 15:53:55:850 EST [DEBUG] wire - http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"
2023/01/06 15:53:55:850 EST [DEBUG] wire - http-outgoing-0 << "Date: Fri, 06 Jan 2023 20:53:55 GMT[\r][\n]"
2023/01/06 15:53:55:850 EST [DEBUG] wire - http-outgoing-0 << "Content-Type: application/json; charset=UTF-8[\r][\n]"
2023/01/06 15:53:55:850 EST [DEBUG] wire - http-outgoing-0 << "Transfer-Encoding: chunked[\r][\n]"
2023/01/06 15:53:55:850 EST [DEBUG] wire - http-outgoing-0 << "Connection: keep-alive[\r][\n]"
2023/01/06 15:53:55:850 EST [DEBUG] wire - http-outgoing-0 << "access-control-allow-origin: *[\r][\n]"
2023/01/06 15:53:55:850 EST [DEBUG] wire - http-outgoing-0 << "content-encoding: gzip[\r][\n]"
2023/01/06 15:53:55:850 EST [DEBUG] wire - http-outgoing-0 << "vary: Accept-Encoding, User-Agent[\r][\n]"
2023/01/06 15:53:55:850 EST [DEBUG] wire - http-outgoing-0 << "[\r][\n]"
2023/01/06 15:53:55:850 EST [DEBUG] wire - http-outgoing-0 << "153[\r][\n]"
2023/01/06 15:53:55:851 EST [DEBUG] wire - http-outgoing-0 << "[0x1f][0x8b][0x8][0x0][0x0][0x0][0x0][0x0][0x0][0x0]}[0x90];o[0xc2]0[0x14][0x85]w~E[0x94][0xb9][0x9]~[0x90][0x4][0xb2][0xb6]j[0xa5].[0xa5][0x2]:t[0x89][0x1c][0xdb][0x10][0x17][0xc7][0x8e][0xfc](E[0x88][0xff][0xde]<h![0xaa][0xd4][0xc1][0xc3][0xbd][0xe7]|[0xf2]=[0xe7]4[0x9][0x82]P[0x91][0x9a][0x87]A[0x1e][0x84]%[0x5]0E[0xed]c[0x9][0x82]$Yd[0x14]s[0x98][0x81][0xc][0x10][0x86][0xc1][0x96][0xa3][0xf0][0xae][0xb3]S[0xe9][0xad][0xe3][0xa6][0xf8][0xc5][0x0][0xc4][0x18][0xa4]h[0x86][0xd2][0x4][0xe6][0xac][0x94][0x9a][0xee]#[0xc7][0xad][0x8b]t[0xc3][0x95][0xe5][0xc4][0xd0]*Bp[0xc]{/X[0xf][0xd3][0xfb][0xf9][0x12]?l[0xde]V[0x9b][0xe3][0xa3][0x94][0xf5]s[0xe9][0xf1][0x13]{[0x1d][0xcc][0x9f][0xdc]X[0xa1]U[0xe7];[0xb5]s[0xbb]a[0xc2]:#J[0xef].[0xeb][0xf0][0xfa]E[0x8f]ti|]r[0xd3][0x8b]([0xc6]1[0xf8][0xd9][0x97]^HV[0xb8]c3[0x1c][0xed][0x88][0x19]+[0x15][0xb1]U[0xaf]x[0xb5]W[0xfa][0xa0][0xc6]*#n[0xe0][0x10]@([0x82]0[0x82]`[0x8d]P[0xe]f9[0x9e][0xc5]8[0xc9]p:[0x1f][0x13]V[0x91][0xc6]V[0xda]u[0xd4][0x96]H[0xcb]/[0xaa][0xf4][0x94]+^[0xdc]d[0xb][0x17][0xb7]w[0xd6]B[0x89][0xda][0xd7][0xc5]A[0x18]^P]7[0xc4][0x89]RH[0xe1][0x8e]#&[0x8b]![0xf8][0xb][0x9][0xc5][0xf8][0xd7][0xbf]T[0x7][0xb5][0xcc][0xb9]/[0xd8][0x91][0x9d][0x14]j[0x8][0xb6][0xae]x[0xf0][0xd2][0xb6][0xb9][0xea][0xdb][0xc][0x96]Fp[0xea][0xf2][0xa0]r[0xae][0xb1][0xf9]tzm:[0xd6]f7[\r]'[0xe7][0xc9]72[0x96][0xa5]W>[0x2][0x0][0x0][\r][\n]"
HTTP/1.1 200 OK
{
  "name" : "bc0162016d521a597c3e17070ad30fe2",
  "cluster_name" : "013306242651:dblock-test-opensearch-21",
  "cluster_uuid" : "cC8P3DUVSUyFllmJbu3GdQ",
  "version" : {
    "distribution" : "opensearch",
    "number" : "2.3.0",
    "build_type" : "tar",
    "build_hash" : "unknown",
    "build_date" : "2022-11-10T22:04:34.357368Z",
    "build_snapshot" : false,
    "lucene_version" : "9.3.0",
    "minimum_wire_compatibility_version" : "7.10.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org/"
}

2023/01/06 15:53:56:073 EST [DEBUG] wire - http-outgoing-1 >> "POST /index_name/type_name/document_id HTTP/1.1[\r][\n]"
2023/01/06 15:53:56:073 EST [DEBUG] wire - http-outgoing-1 >> "Accept-Encoding: gzip,deflate[\r][\n]"
2023/01/06 15:53:56:074 EST [DEBUG] wire - http-outgoing-1 >> "Authorization: AWS4-HMAC-SHA256 ..."
2023/01/06 15:53:56:074 EST [DEBUG] wire - http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
2023/01/06 15:53:56:074 EST [DEBUG] wire - http-outgoing-1 >> "Content-Length: 15[\r][\n]"
2023/01/06 15:53:56:074 EST [DEBUG] wire - http-outgoing-1 >> "Content-Type: application/json[\r][\n]"
2023/01/06 15:53:56:074 EST [DEBUG] wire - http-outgoing-1 >> "Host: ....us-west-2.es.amazonaws.com[\r][\n]"
2023/01/06 15:53:56:074 EST [DEBUG] wire - http-outgoing-1 >> "User-Agent: Apache-HttpClient/4.5.14 (Java/19.0.1)[\r][\n]"
2023/01/06 15:53:56:074 EST [DEBUG] wire - http-outgoing-1 >> "X-Amz-Date: 20230106T205355Z[\r][\n]"
2023/01/06 15:53:56:074 EST [DEBUG] wire - http-outgoing-1 >> "X-Amz-Security-Token: ..."
2023/01/06 15:53:56:074 EST [DEBUG] wire - http-outgoing-1 >> "[\r][\n]"
2023/01/06 15:53:56:074 EST [DEBUG] wire - http-outgoing-1 >> "{"test": "val"}"
2023/01/06 15:53:56:149 EST [DEBUG] wire - http-outgoing-1 << "HTTP/1.1 400 Bad Request[\r][\n]"
2023/01/06 15:53:56:150 EST [DEBUG] wire - http-outgoing-1 << "Date: Fri, 06 Jan 2023 20:53:56 GMT[\r][\n]"
2023/01/06 15:53:56:150 EST [DEBUG] wire - http-outgoing-1 << "Content-Type: application/json; charset=UTF-8[\r][\n]"
2023/01/06 15:53:56:150 EST [DEBUG] wire - http-outgoing-1 << "Content-Length: 90[\r][\n]"
2023/01/06 15:53:56:150 EST [DEBUG] wire - http-outgoing-1 << "Connection: keep-alive[\r][\n]"
2023/01/06 15:53:56:150 EST [DEBUG] wire - http-outgoing-1 << "access-control-allow-origin: *[\r][\n]"
2023/01/06 15:53:56:150 EST [DEBUG] wire - http-outgoing-1 << "[\r][\n]"
2023/01/06 15:53:56:151 EST [DEBUG] wire - http-outgoing-1 << "{"error":"no handler found for uri [/index_name/type_name/document_id] and method [POST]"}"
HTTP/1.1 400 Bad Request
{"error":"no handler found for uri [/index_name/type_name/document_id] and method [POST]"}
[WARNING] 
java.lang.RuntimeException: Bad Request
    at io.github.acm19.aws.interceptor.test.Sample.logRequest (Sample.java:115)
    at io.github.acm19.aws.interceptor.test.AmazonOpenSearchServiceSample.indexDocument (AmazonOpenSearchServiceSample.java:93)
    at io.github.acm19.aws.interceptor.test.AmazonOpenSearchServiceSample.main (AmazonOpenSearchServiceSample.java:77)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:279)
    at java.lang.Thread.run (Thread.java:1589)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.619 s
[INFO] Finished at: 2023-01-06T15:53:56-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:java (default-cli) on project aws-request-signing-apache-interceptor: An exception occurred while executing the Java class. Bad Request -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
make: *** [run_sample] Error 1