我已使用以下代码全局安装了 npm 模块 aws-amplify/cli:
npm install -g @aws-amplify/cli
Run Code Online (Sandbox Code Playgroud)
这有效,但是当尝试使用 amplify cli 初始化我的环境时,它给了我以下错误:
/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/queue-microtask/index.js:1
ReferenceError: globalThis is not defined
at Object.<anonymous> (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/queue-microtask/index.js:5:25)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Object.<anonymous> (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/run-parallel/index.js:4:24)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Object.<anonymous> (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/@nodelib/fs.scandir/out/providers/async.js:5:13)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Object.<anonymous> (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/@nodelib/fs.scandir/out/index.js:4:15)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Object.<anonymous> (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/@nodelib/fs.walk/out/readers/async.js:4:19)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Object.<anonymous> (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/@nodelib/fs.walk/out/providers/async.js:3:17)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Object.<anonymous> (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/@nodelib/fs.walk/out/index.js:4:17)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Object.Module._extensions..js …Run Code Online (Sandbox Code Playgroud) 我是 AWS Amplify 和 GraphQL 的新手。也刚刚开始构建 React Native App - 这很有趣!
我有一个名为 TimePeriods 架构的表,它看起来像这样
type TimePeriod @model {
id: ID!
name: String!
startYear: String!
endYear: String!,
artworks: [ArtWorkTimePeriod] @connection (name: "TimePeriodArtWorks") #Many to Many Relationship
artists: [ArtistTimePeriod] @connection (name: "TimePeriodArtists") #Many to Many Relationship
}
Run Code Online (Sandbox Code Playgroud)
在由 amplify 生成的查询文件中,我有一个名为 listTimePeriods 的函数。
export const listTimePeriods = /* GraphQL */ `
query ListTimePeriods(
$filter: ModelTimePeriodFilterInput
$limit: Int
$nextToken: String
) {
listTimePeriods(filter: $filter, limit: $limit, nextToken: $nextToken) {
items {
id
name
startYear …Run Code Online (Sandbox Code Playgroud) 我的 React 应用程序使用 GraphQL API、存储、身份验证、函数、托管 - 所有有趣的东西 - 所以我必须有一个aws-exports.js可用的文件。使用放大后端资源来放大 React 前端。
回购协议基本上设置为:
package.json
src/
- aws-exports.js
- app.js
- ...etc
Run Code Online (Sandbox Code Playgroud)
并在每个目录中执行一个ls操作,显示在构建中没有aws-exports.js生成文件。
通过许多不同的配置,我遇到了:
[INFO]: # Executing command: yarn run build
[INFO]: yarn run v1.16.0
[INFO]: $ react-scripts build
[INFO]: Creating an optimized production build...
[INFO]: Failed to compile.
[INFO]: ./src/App.js
Cannot find file './aws-exports' in './src'.
2020-04-30T00:52:34.883Z [WARNING]: error Command failed with exit code 1.
Run Code Online (Sandbox Code Playgroud)
当我签入amplify.yml并.yml在网络控制台中进行配置时就是如此。
我已经尝试过amplify push;,但正如预期的那样遇到了
An …Run Code Online (Sandbox Code Playgroud) 使用 Cognito 用户池放大 CLI 身份验证目前有两种主要模式,使用用户名或电子邮件登录。在前一种情况下,电子邮件唯一性作为必需的用户属性没有被强制执行。
Cognito 服务本身支持“还允许使用经过验证的电子邮件地址登录”选项(AWS 控制台,用户池属性部分),但只能在创建用户池时进行设置(即以后无法修改 - 复选框已禁用)。是否可以在允许用户使用用户名或电子邮件进行身份验证的同时在用户池中强制执行无重复电子邮件?
总而言之,我的用例需要:
Auth.SignUp;Auth.SignIn使用电子邮件或用户名作为用户名参数提供)。authentication amazon-web-services amazon-cognito aws-amplify aws-amplify-cli
我已经安装了'amplify-cli'。当我输入“放大配置”时,我收到错误消息:
“放大不是内部或外部命令,也不是可运行的程序或批处理文件”。
我是使用 AWS Amplify 的新手,我刚刚发布了我自己的前端 WebApp,它是用 React 开发的。我刚刚压缩了我的构建文件夹并将生成的 zip 文件放到 AWS 控制台中。它工作正常。
但是,这项工作是手动完成的,我想自动化。除了 AWS 中的那些之外,我还有 CI&CD 服务器,它们可以很好地用于我的其他服务。所以我需要的是一个脚本来自动化我刚刚做的事情,因为我想重用我现有的 CI&CD 服务器。拥有这样的脚本将非常有用,因为我可以在本地或在 docker 容器中重现这些步骤。
我知道有一个解决方案:放大 CLI。但是,即使 AWS 配置文件(带有密钥和访问密钥)已经配置,诸如amplify init,amplify configure和 之类的命令也amplify pull需要很多权限和大量用户交互。
做这样的事情会很棒:
amplify deploy build.zip <APP-ARN>
或(如果是文件夹)
amplify deploy /build <APP-ARN>
本质上,我只想自动化我手动执行的操作:上传(压缩)构建文件夹以部署我的 AWS Amplify 应用程序。因此,这意味着没有用户交互。
这该怎么做?
我有一个将资源推送到云的放大反应应用程序。不幸的是,当我去提交时,我删除了 team-provider-info.json 而没有备份它。我在我的本地项目中拥有源自 amplify 的所有其他文件。我可以在不重新开始的情况下重新生成 team-provider-info.json 吗?这里没有关于该过程的信息:https : //aws-amplify.github.io/docs/cli-toolchain/quickstart#teamprovider
我正在使用AWS的放大框架在 Vue.js 中构建一个 web 应用程序。
至于现在,我正在使用cognito服务来验证用户。
我想在用户第一次创建他的帐户时触发一个 lambda 函数。我已经使用以下命令创建了一个 lambda 函数:
amplify function add
Run Code Online (Sandbox Code Playgroud)
我使用以下命令测试了我的功能:
amplify function invoke myLambdaFunction
Run Code Online (Sandbox Code Playgroud)
现在我想在用户创建帐户时触发此功能。
知道我该怎么做吗?
谢谢你,亚历克西斯
amazon-web-services amazon-cognito aws-lambda aws-amplify aws-amplify-cli
我正在运行下面的 GraphQL 查询来在 dynamodb 表上创建数据,但得到的响应是“未授权访问 Client 类型上的 createClient”
为什么会发生这种情况。
GraphQL 查询:
`mutation addClient{
createClient(input:{
fullName: "Jhon Smith"
title: "Software Engineer"
organization: "AWS"
contactNo: "+341289655524"
email: "smithj@amazon.com"
country: "Canada"
address: "AN/458, Norton place, Down Town"
}){
fullName
}
}`
Run Code Online (Sandbox Code Playgroud)
回复 :
{
"data": {
"createClient": null
},
"errors": [
{
"path": [
"createClient"
],
"data": null,
"errorType": "Unauthorized",
"errorInfo": null,
"locations": [
{
"line": 2,
"column": 3,
"sourceName": null
}
],
"message": "Not Authorized to access createClient on type Client"
} …Run Code Online (Sandbox Code Playgroud) aws-amplify-cli ×10
aws-amplify ×8
graphql ×2
graphql-js ×2
react-native ×2
android ×1
aws-appsync ×1
aws-lambda ×1
node.js ×1
npm ×1