gpt4 book ai didi

erlang - 使用 elcloud_s3 上传文件到 S3 i

转载 作者:行者123 更新时间:2023-12-04 00:46:10 26 4
gpt4 key购买 nike

我正在尝试使用 erlang 模块 erlcloud_s3 将文件上传到 S3。由于某种原因,我无法解决它是行不通的。我已经包含了我的代码(当然删除了 key )以及我尝试运行它时得到的响应。有人能告诉我我遗漏了什么吗(或者是否有更好的 Erlang AWS 包实际上有一些文档或示例?)

-module(compose).

-define('ACCESS_KEY', "********************").
-define('SECRET_ACCESS_KEY', "****************************************").
-define('BUCKET', "zacharykessin").

-export([upload/2, upload_file/2]).

upload_file(Key, Path) ->
R = file:read_file(Path),
{ok, Binary} = R,
upload(Key, Binary).


upload(Key, Value) ->
A = erlcloud_ec2:configure(?ACCESS_KEY, ?SECRET_ACCESS_KEY),
error_logger:info_msg("~p:~p Settng up AWS ~p to S3 ~n",
[?MODULE, ?LINE, A]),
R = erlcloud_s3:put_object(?BUCKET, Key, Value, [], [{"Content-type", "image/jpeg"}]),

error_logger:info_msg("~p:~p Uploaded File ~p to S3 ~n",
[?MODULE, ?LINE, R]),
{ok, R}.


{noproc,
{gen_server,call,
[httpc_manager,
{request,
{request,undefined,<0.2.0>,0,https,
{"zacharykessin.s3.amazonaws.com",443},
"/test",[],put,
{http_request_h,undefined,"keep-alive",
"Thu, 15 Mar 2012 14:22:14 GMT",
undefined,undefined,undefined,undefined,
undefined,undefined,undefined,undefined,
undefined,undefined,
["AWS ","********************",58,
<<"1O6HYjq8RU8sqtD8oZd1T+bMNCE=">>],
undefined,undefined,
"zacharykessin.s3.amazonaws.com",
undefined,undefined,undefined,undefined,
undefined,undefined,undefined,undefined,
undefined,[],undefined,undefined,...},
{"application/octet_stream",
<<255,216,255,224,0,16,74,70,73,70,0,1,2,1,
1,44,1,44,0,0,255,225,25,59,69,120,105,...>>},
{http_options,"HTTP/1.1",infinity,true,
{essl,[]},
undefined,false,infinity,false},
"https://zacharykessin.s3.amazonaws.com/test",
[],none,[],1331821334636,undefined,undefined,
false}},
infinity]}}

最佳答案

确保运行

inets:start()

运行代码之前的某处。

您得到的错误意味着没有这样的进程 (noproc) 注册为 httpc_manager,它是 inets 库的一部分申请。

关于erlang - 使用 elcloud_s3 上传文件到 S3 i,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9721878/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com