gpt4 book ai didi

javascript - AWS CLI 无效的 JSON 错误 - 需要用双引号引起来的属性名称

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:12:18 24 4
gpt4 key购买 nike

我正在使用 javascript 编写一个依赖 AWS 的应用程序,并且我正在使用 AWS CLI 来自动化我的 AWS 资源的构建过程。我正在尝试创建启用了 CORS 的 API 网关资源。在调用 api 网关 CLI 的 put-integration-response 方法时,当我添加 --response-parameters 参数时,我收到以下错误:

>> Error parsing parameter '--response-parameters': Invalid JSON: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
>> JSON received: {method.response.header.Access-Control-Allow-Origin:'*'}

这是导致问题的 --response-parameters 参数:

--response-parameters {"method.response.header.Access-Control-Allow-Origin":"\'*\'"}

如果有帮助,这个论点是通过 Grunt 的 grunt-exec 插件提供的。究竟是什么导致了这个问题?我试过添加更多双引号,但它们似乎没有出现在“JSON received”中。

最佳答案

这是来自 here 的针对此问题的另一个修复程序

在 Windows 上,基本上您在 JSON 中的引号前使用\:Linux/Mac:

 --expression-attribute-values '{ ":u": {"S":"anotherUser"}}'

在 Windows 上是这样的:

--expression-attribute-values '{ \":u\": {\"S\":\"anotherUser\"}}'

希望对你解决错误有帮助

关于javascript - AWS CLI 无效的 JSON 错误 - 需要用双引号引起来的属性名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43615473/

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