과 함께 ExAws 라이브러리를 사용하려고합니다. 내가 파일 업로드하려고 :phoenix elixir exaws 미니 오 (파일 업로드)와 함께 사용
filepath
|> S3.Upload.stream_file
|> S3.upload(bucket_name, path)
|> ExAws.request!
을 나는 오류가 발생 : 나는 응답에 의해 참조
[error] #PID<0.1041.0> running Myapp.Endpoint terminated
Server: localhost:4000 (http)
Request: POST /resources/upload
** (exit) an exception was raised:
** (MatchError) no match of right hand side value: %{body: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<InitiateMultipartUploadResult xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Bucket>user-1</Bucket><Key>docs/tsetup.0.9.51.tar.xz</Key><UploadId>35e9c8b0-ac34-4411-b39b-790a0104df93</UploadId></InitiateMultipartUploadResult>", headers: [{"Accept-Ranges", "bytes"}, {"Server", "Minio/DEVELOPMENT.GOGET (linux; amd64)"}, {"Vary", "Origin"}, {"X-Amz-Request-Id", "K4O7RNNSRLAMSL26"}, {"Date", "Tue, 11 Oct 2016 20:53:58 GMT"}, {"Content-Type", "text/xml; charset=utf-8"}, {"Transfer-Encoding", "chunked"}], status_code: 200}
(ex_aws) lib/ex_aws/s3/upload.ex:39: ExAws.S3.Upload.initialize!/2
(ex_aws) lib/ex_aws/s3/upload.ex:80: ExAws.Operation.ExAws.S3.Upload.perform/2
(ex_aws) lib/ex_aws.ex:41: ExAws.request!/2
(Myapp) web/models/resource.ex:68: Myapp.Resource.put_file_to_cloud/1
(Myapp) web/controllers/resource_controller.ex:59: Myapp.ResourceController.upload/2
(Myapp) web/controllers/resource_controller.ex:1: Myapp.ResourceController.action/2
(Myapp) web/controllers/resource_controller.ex:1: Myapp.ResourceController.phoenix_controller_pipeline/2
(Myapp) lib/Myapp/endpoint.ex:1: Myapp.Endpoint.instrument/4
(Myapp) lib/phoenix/router.ex:261: Myapp.Router.dispatch/2
(Myapp) web/router.ex:1: Myapp.Router.do_call/2
(Myapp) lib/Myapp/endpoint.ex:1: Myapp.Endpoint.phoenix_pipeline/1
(Myapp) lib/plug/debugger.ex:123: Myapp.Endpoint."call (overridable 3)"/2
(Myapp) lib/Myapp/endpoint.ex:1: Myapp.Endpoint.call/2
(plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
(cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4
는 파일 업로드가 시작되는. 이 미니는 대답을 예상대로하지 않습니다 exaws? 또는 문제가 다른 것입니까?
는 UPD는 : sweet_xml 지금은 다른 오류 얻을 추가 한 후 : 같은 시간에
[error] GenServer #PID<0.593.0> terminating
** (MatchError) no match of right hand side value: nil
(ex_aws) lib/ex_aws/s3/upload.ex:69: ExAws.S3.Upload.upload_chunk!/3
lib/flow/materialize.ex:493: anonymous fn/4 in Experimental.Flow.Materialize.mapper/2
lib/flow/materialize.ex:462: Experimental.Flow.Materialize."-mapper_ops/1-lists^foldl/2-1-"/3
lib/flow/materialize.ex:462: anonymous fn/5 in Experimental.Flow.Materialize.mapper_ops/1
lib/flow/map_reducer.ex:57: Experimental.Flow.MapReducer.handle_events/3
lib/gen_stage.ex:2190: Experimental.GenStage.consumer_dispatch/7
lib/gen_stage.ex:2313: Experimental.GenStage.take_pc_events/3
(stdlib) gen_server.erl:601: :gen_server.try_dispatch/4
(stdlib) gen_server.erl:667: :gen_server.handle_msg/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_consumer", {#PID<0.592.0>, #Reference<0.0.2.533>}, [{<<255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1, 1, 0, 72, 0, 72, 0, 0, 255, 219, 0, 67, 0, 2, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 5, 3, 3, 3, 3, 3, 6, ...>>, 1}]}
State: {%{#Reference<0.0.2.533> => nil}, %{consumers: [{#Reference<0.0.2.544>, #Reference<0.0.2.546>}], done: [#Reference<0.0.2.533>], done?: false, trigger: #Function<2.69990182/4 in Experimental.Flow.Window.Global.materialize/4>}, {0, 4}, [], #Function<29.77971684/4 in Experimental.Flow.Materialize.mapper_ops/1>}
[error] Ranch protocol #PID<0.587.0> (:cowboy_protocol) of listener Myapp.Endpoint.HTTP terminated
** (exit) an exception was raised:
** (MatchError) no match of right hand side value: nil
(ex_aws) lib/ex_aws/s3/upload.ex:69: ExAws.S3.Upload.upload_chunk!/3
lib/flow/materialize.ex:493: anonymous fn/4 in Experimental.Flow.Materialize.mapper/2
lib/flow/materialize.ex:462: Experimental.Flow.Materialize."-mapper_ops/1-lists^foldl/2-1-"/3
lib/flow/materialize.ex:462: anonymous fn/5 in Experimental.Flow.Materialize.mapper_ops/1
lib/flow/map_reducer.ex:57: Experimental.Flow.MapReducer.handle_events/3
lib/gen_stage.ex:2190: Experimental.GenStage.consumer_dispatch/7
lib/gen_stage.ex:2313: Experimental.GenStage.take_pc_events/3
(stdlib) gen_server.erl:601: :gen_server.try_dispatch/4
(stdlib) gen_server.erl:667: :gen_server.handle_msg/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
을, 나는 다운로드가 와이어 샤크 에 있다고 볼 수 있지만, 좀 더보고
저장 폴더에 비어 Frame 1138: 344 bytes on wire (2752 bits), 344 bytes captured (2752 bits) on interface 0 Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00) Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1 Transmission Control Protocol, Src Port: 9000 (9000), Dst Port: 42324 (42324), Seq: 515, Ack: 1539815, Len: 278 Hypertext Transfer Protocol HTTP/1.1 200 OK\r\n Accept-Ranges: bytes\r\n Etag: "2501de281894f7a1f79e8e0d6b8e7d85"\r\n Server: Minio/DEVELOPMENT.GOGET (linux; amd64)\r\n Vary: Origin\r\n X-Amz-Request-Id: M81ULLKCXKH0KRXD\r\n Date: Fri, 14 Oct 2016 15:00:16 GMT\r\n Content-Length: 0\r\n Content-Type: text/plain; charset=utf-8\r\n \r\n [HTTP response 2/2] [Time since request: 0.008850143 seconds] [Prev request in frame: 1016] [Prev response in frame: 1028] [Request in frame: 1032]
UPD : Minio의 응답에서, 나는 ETAG가 볼 문제가 ExAws 라이브러리의 저자에 의해 해결된다 - https://github.com/CargoSense/ex_aws/issues/253
감사합니다! sweet_xml을 추가 한 후에 다른 오류가 발생합니다. –
AWS에 청크로 업로드하면 각 청크 요청과 함께 ETag가 반환되고 라이브러리 코드는 응답으로 'etag'를 기다리고 있습니다. AWS의 응답으로 해당 정보를 찾을 수 없어 일치가 실패합니다. 각 청크 업로드에 대한 AWS의 자세한 HTTP 응답을 검토하고 ETag 필드가 포함되어 있는지 확인하십시오. 멀티 파트 업로드를 완료하려면 AWS의 ETag 응답이 필요합니다. –
미니 홈피의 응답에 etag가 있습니다 –