小编ime*_*emi的帖子

如何从API网关自定义授权程序中抛出自定义错误消息

这里的蓝图说,API网关将与401回应:未经授权.

raise Exception('Unauthorized')在lambda中写了同样的内容,并且可以从Lambda Console中测试它.但是在POSTMAN中,我正在接收500 身体状态:

{
  message: null`
} 
Run Code Online (Sandbox Code Playgroud)

我想添加自定义错误消息,如"无效签名","TokenExpired"等,任何文档或指导将不胜感激.

aws-api-gateway

14
推荐指数
3
解决办法
5602
查看次数

在nodejs中安装bycrpt时出错?每当我运行 npm install install --save?

> bcrypt@3.0.0 install C:\projects\alecadApi\node_modules\bcrypt
> node-pre-gyp install --fallback-to-build

`node-pre-gyp` WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.0/bcrypt_lib-v3.0.0-node-v57-win32-x64-unknown.tar.gz
`node-pre-gyp` WARN Pre-built binaries not found for bcrypt@3.0.0 and node@8.10.0 (node-v57 ABI, unknown) (falling back to source compile with node-gyp)
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
`C:\projects\alecadApi\node_modules\bcrypt\build\bcrypt_lib.vcxproj(20,3)`: error MSB4019: The imported project "C:\Microsoft.Cp
p.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on …
Run Code Online (Sandbox Code Playgroud)

window bcrypt node.js npm

3
推荐指数
2
解决办法
2万
查看次数

厨师:没有名为"httpd"的公式

我正在学习厨师,在尝试安装httpd包时我遇到了困难.我有一个简单的方法在Mac OS上安装httpd包.我安装了ChefDK.

webserver.rb

package 'httpd' 
Run Code Online (Sandbox Code Playgroud)

当我跑chef-apply webserver.rb,它会抛出错误:

    Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of brew info --json=v1 httpd ----
STDOUT: 
STDERR: Error: No available formula with the name "httpd"
---- End output of brew info --json=v1 httpd ----
Ran brew info --json=v1 httpd returned 1

Resource Declaration:
---------------------
# In webserver.rb

  1: package 'httpd'

Compiled Resource:
------------------
# Declared in webserver.rb:1:in `run_chef_recipe'

homebrew_package("httpd") do
  action [:install]
  retries 0
  retry_delay 2 …
Run Code Online (Sandbox Code Playgroud)

cookbook chef-infra chef-recipe

2
推荐指数
1
解决办法
1197
查看次数

如何使用 Ruby Base64 模块对哈希进行编码

我正在尝试编码一个散列,我希望它返回一些我知道的值。这是我编写的用于编码的 ruby​​ 脚本。

policy = {
 "expiration": "2015-12-30T12:00:00.000Z",
 "conditions": [
   {"bucket": "sigv4examplebucket"},
   ["starts-with", "$key", "user/user1/"],
   {"acl": "public-read"},
   {"success_action_redirect": "http://sigv4examplebucket.s3.amazonaws.com/successful_upload.html"},
   ["starts-with", "$Content-Type", "image/"],
   {"x-amz-meta-uuid": "14365123651274"},
   {"x-amz-server-side-encryption": "AES256"},
   ["starts-with", "$x-amz-meta-tag", ""],
   {"x-amz-credential": "AKIAIOSFODNN7EXAMPLE/20151229/us-east-1/s3/aws4_request"},
   {"x-amz-algorithm": "AWS4-HMAC-SHA256"},
   {"x-amz-date": "20151229T000000Z" }
 ]
}.to_s

enc = Base64.encode64(policy)
Run Code Online (Sandbox Code Playgroud)

预期编码值:

eyAiZXhwaXJhdGlvbiI6ICIyMDE1LTEyLTMwVDEyOjAwOjAwLjAwMFoiLA0KICAiY29uZGl0aW9ucyI6IFsNCiAgICB7ImJ1Y2tldCI6ICJzaWd2NGV4YW1wbGVidWNrZXQifSwNCiAgICBbInN0YXJ0cy13aXRoIiwgIiRrZXkiLCAidXNlci91c2VyMS8iXSwNCiAgICB7ImFjbCI6ICJwdWJsaWMtcmVhZCJ9LA0KICAgIHsic3VjY2Vzc19hY3Rpb25fcmVkaXJlY3QiOiAiaHR0cDovL3NpZ3Y0ZXhhbXBsZWJ1Y2tldC5zMy5hbWF6b25hd3MuY29tL3N1Y2Nlc3NmdWxfdXBsb2FkLmh0bWwifSwNCiAgICBbInN0YXJ0cy13aXRoIiwgIiRDb250ZW50LVR5cGUiLCAiaW1hZ2UvIl0sDQogICAgeyJ4LWFtei1tZXRhLXV1aWQiOiAiMTQzNjUxMjM2NTEyNzQifSwNCiAgICB7IngtYW16LXNlcnZlci1zaWRlLWVuY3J5cHRpb24iOiAiQUVTMjU2In0sDQogICAgWyJzdGFydHMtd2l0aCIsICIkeC1hbXotbWV0YS10YWciLCAiIl0sDQoNCiAgICB7IngtYW16LWNyZWRlbnRpYWwiOiAiQUtJQUlPU0ZPRE5ON0VYQU1QTEUvMjAxNTEyMjkvdXMtZWFzdC0xL3MzL2F3czRfcmVxdWVzdCJ9LA0KICAgIHsieC1hbXotYWxnb3JpdGhtIjogIkFXUzQtSE1BQy1TSEEyNTYifSwNCiAgICB7IngtYW16LWRhdGUiOiAiMjAxNTEyMjlUMDAwMDAwWiIgfQ0KICBdDQp9

但我的 ruby​​ 脚本正在返回:

ezpleHBpcmF0aW9uPT4iMjAxNS0xMi0zMFQxMjowMDowMC4wMDBaIiwgOmNvbmRpdGlvbnM9Plt7OmJ1Y2tldD0++IjIwMTUxMjI5VDAwMDAwMFoifV19

当我使用https://www.base64encode.org/ 时,它返回的正是预期的内容。我从http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-post-example.html获取了预期值

我做得对吗?

ruby base64 amazon-s3 aws-api-gateway

2
推荐指数
1
解决办法
3823
查看次数

Spring WebClient:Retry.backoff 的默认乘数是多少?

我试图了解 Spring WebClient Retry.backoff 方法的指数退避策略的默认乘数。并且这个可以配置吗?我找不到这方面的文档。

https://projectreactor.io/docs/core/release/api/reactor/util/retry/Retry.html#backoff-long-java.time.Duration-

版本: reactor-netty 0.9.12.RELEASE

spring reactor-netty spring-webclient

2
推荐指数
1
解决办法
1761
查看次数