标签: aws-amplify

由于 aws-exports,AWS 放大部署失败

我正在尝试将我的 reactJs 应用程序部署到 Amplify。我的 Github 连接到 Amplify。在部署期间,它在构建步骤中显示以下错误:

2020-01-07T19:35:22.127Z [INFO]: Failed to compile.
2020-01-07T19:35:22.129Z [INFO]: ./src/index.js
                                 Cannot find file './aws-exports' in './src'.
2020-01-07T19:35:22.149Z [WARNING]: error Command failed with exit code 1.
2020-01-07T19:35:22.150Z [INFO]: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2020-01-07T19:35:22.155Z [ERROR]: !!! Build failed
2020-01-07T19:35:22.239Z [ERROR]: !!! Non-Zero Exit Code detected
2020-01-07T19:35:22.239Z [INFO]: # Starting environment caching...
Run Code Online (Sandbox Code Playgroud)

发生这种情况是因为.gitignore忽略了 aws-exports。有人可以告诉我在不提交 aws-exports 的情况下解决此问题的方法是什么?

amazon-web-services reactjs serverless aws-amplify

22
推荐指数
1
解决办法
1万
查看次数

“AmplifySignOut”未从“@aws-amplify/ui-react”导出

我今天也遇到这个问题了,而且是今天才开始的。运行通常的安装顺序并推送来构建应用程序......

npx create-react-app exampleapp
npm start
amplify init
amplify add api
Amplify push
npm install aws-amplify @aws-amplify/ui-react
amplify add auth
amplify push
Run Code Online (Sandbox Code Playgroud)

像往常一样对 index.js 和 ap.js 进行更改。

索引.js:

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import Amplify from 'aws-amplify';
import aws_exports from './aws-exports'

Amplify.configure(aws_exports);

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

reportWebVitals();
Run Code Online (Sandbox Code Playgroud)

应用程序.js:

import React from 'react';
import './App.css';
import { withAuthenticator, AmplifySignOut, Authenticator } from '@aws-amplify/ui-react';
import { …
Run Code Online (Sandbox Code Playgroud)

authentication reactjs aws-amplify

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

AuthError - 错误:未正确配置放大

首先,我使用amplify configure. 我是在AWS Amplify 文档的帮助下完成的。然后我成功地将身份验证添加到我的放大项目中,使用amplify add authamplify push。我遵循了AWS - Authentication with Amplify Doc中的所有步骤

我的长App.js这样

import React from 'react';
import { withAuthenticator, AmplifySignOut } from '@aws-amplify/ui-react';
import Amplify, { Auth } from 'aws-amplify';
import awsconfig from './aws-exports';

Amplify.configure(awsconfig);


const App = () => (
    <div>
        <AmplifySignOut />
        My App
    </div>
);

export default withAuthenticator(App);
Run Code Online (Sandbox Code Playgroud)

但是当我尝试时npm start,它显示以下错误, AuthError - 错误:Amplify 配置不正确。

amazon-web-services reactjs aws-amplify

18
推荐指数
4
解决办法
8075
查看次数

如何在 Amplify 控制台的配置步骤中更改节点版本

我面临无法通过 AWS Amplify 控制台构建 Angular 应用程序的问题:“您正在运行 Node.js 的 v8.12.0 版本,Angular CLI 8.0+ 不支持该版本。官方 Node.js 版本是支持 10.9 或更高版本。请访问https://nodejs.org/en/以查找有关如何更新 Node.js 的说明。”

现在我想在配置步骤中将docker容器的默认节点版本设置为容器中已经定义的VERSION_NODE_10。

# Framework Versions
ENV VERSION_NODE_8=8.12.0
ENV VERSION_NODE_6=6
ENV VERSION_NODE_10=10
ENV VERSION_NODE_DEFAULT=$VERSION_NODE_8 <-- Change this to $VERSION_NODE_10
ENV VERSION_RUBY_2_3=2.3.6
ENV VERSION_RUBY_2_4=2.4.3
ENV VERSION_RUBY_DEFAULT=$VERSION_RUBY_2_3
ENV VERSION_HUGO=0.51
ENV VERSION_YARN=1.13.0
Run Code Online (Sandbox Code Playgroud)

放大.yml:

# Framework Versions
ENV VERSION_NODE_8=8.12.0
ENV VERSION_NODE_6=6
ENV VERSION_NODE_10=10
ENV VERSION_NODE_DEFAULT=$VERSION_NODE_8 <-- Change this to $VERSION_NODE_10
ENV VERSION_RUBY_2_3=2.3.6
ENV VERSION_RUBY_2_4=2.4.3
ENV VERSION_RUBY_DEFAULT=$VERSION_RUBY_2_3
ENV VERSION_HUGO=0.51
ENV VERSION_YARN=1.13.0
Run Code Online (Sandbox Code Playgroud)

有谁知道如何更改默认值?

amazon-web-services node.js aws-amplify

17
推荐指数
5
解决办法
6802
查看次数

React Router DOM 在 Amplify Console AWS 上无法正常工作

我已经按照他们的文档在 Amplify 控制台上部署了 React 应用程序。该站点已部署并运行良好,我可以使用链接进行导航,但是当我尝试直接登陆任何 url 时,我被重定向到我配置的 404 页面。

下面是我正在使用的代码

ReactDOM.render(
  <Router>
    <Route path="/" component={App} />
  </Router>,
  document.getElementById("root"),
);
Run Code Online (Sandbox Code Playgroud)

这是我的路线的样子 -

<Switch>
    <Route
      exact
      path="/"
      render={(): JSX.Element => <Home auth={this.auth} />}
    />
    <Route path="/features" render={(): JSX.Element => <Features />} />
    <Route
      path="/pagenotfound"
      render={(): JSX.Element => <PageNotFound />}
    />
    <Redirect from="/**" to="/pagenotfound" />
</Switch>
Run Code Online (Sandbox Code Playgroud)

这是应用程序的链接 - https://master.dkf0zemoh330o.amplifyapp.com/features

amazon-web-services create-react-app aws-amplify

17
推荐指数
1
解决办法
6836
查看次数

AWS Amplify cloudformation parameter.json 如何工作?

我最近开始使用 AWS Amplify,并且有使用 vanilla cloudformation 的经验。除了parameters.json部分之外,大部分内容都有意义。

貌似Amplify为我们使用的资源生成了cloudformation模板,但是它也生成了一个parameters.json文件,我以为相当于Parameterscloudformation的那一段,但好像不是。

在 Amplify 中parameters.json,内容只是object使用键值对。而在 cloudformation 中,参数具有如文档中所述的定义语法。

此外,parameters.json它似乎能够Ref以与 cloudformation 模板相同的方式进行调用。有谁知道什么是解析parameters.json文件并用Ref实际值替换?

例如在storage类别中,parameters.json文件有这样的键

"authRoleName": {
    "Ref": "AuthRoleName"
},
Run Code Online (Sandbox Code Playgroud)

AuthRoleName好像在两个目录amplify-meta.json下都定义了backend,但是team-provider-info.jsonamplify目录下也定义了。

有谁知道AuthRoleName它使用的是哪个文件?从我的文档阅读,无论是amplify-meta.jsonteam-provider-info.json是自动生成的。

出现了很多这些问题,因为我很好奇是否可以在 cloudformation UI 中手动执行 CF 中自动生成的 CF 模板。当我尝试复制参数部分和元数据部分时,我得到了无效的语法。

这让我认为 amplify 是使用它自己的解析器来生成最终的 CF 模板并在 CF 中执行它。我尝试搜索 cli 存储库,但找不到。

amazon-web-services aws-cloudformation aws-amplify

17
推荐指数
1
解决办法
1466
查看次数

AWS Amplify/CLI与AWS移动中心

我是AWS移动中心的新手,今天我只注意到有一个新的AWS Amplify/CL,现在我对这两个库非常困惑.

我的理解是AWS mobile cli是一个创建aws后端服务的工具,并且放大js只是与aws后端连接的客户端库.

但现在我看到这个AWS Amplify/CLI,它也可以创建aws服务并创建aws-exports.js文件,现在AWS Amplify文档已经改变,它不再告诉你它如何与移动集线器一起工作,而是使用Amplify/CLI以创建服务.

剂量是否意味着我应该使用AWS Amplify/CLI?

amazon-web-services aws-cli aws-mobilehub aws-amplify

16
推荐指数
1
解决办法
2631
查看次数

使用 AWS Amplify 创建 process.env 变量?

使用无服务器,我们可以process.env通过创建这样的配置文件条目来添加变量:

environment:
    STRIPE_SECRET_KEY: ${self:custom.secrets.stripeSecretKey} # Stripe secret API key
Run Code Online (Sandbox Code Playgroud)

我们可以像这样在 lambda 函数中访问它:

const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
Run Code Online (Sandbox Code Playgroud)

我们如何使用 AWS Amplify 做到这一点?

amazon-web-services node.js aws-lambda aws-sdk-js aws-amplify

16
推荐指数
1
解决办法
8541
查看次数

包含`声明模块'graphql/error/GraphQLError'的声明(.d.ts)文件;在 angular 项目的 index.d.ts 中

我在一个角度项目中使用放大。当我运行命令 ng serve 时出现此错误。

Error: node_modules/@aws-amplify/api-graphql/lib-esm/types/index.d.ts:1:30 - error TS7016: Could not find a declaration file for module 'graphql/error/GraphQLError'. 'C:/Users/Ruwani Indrachapa/Documents/profileApp/profileApp1/node_modules/graphql/error/GraphQLError.js' implicitly has an 'any' type.
 Try `npm install @types/graphql` if it exists or add a new declaration (.d.ts) file containing `declare module 'graphql/error/GraphQLError';`

1 import { GraphQLError } from 'graphql/error/GraphQLError';
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@aws-amplify/api-graphql/lib-esm/types/index.d.ts:2:30 - error TS7016: Could not find a declaration file for module 'graphql/language/ast'. 'C:/Users/Ruwani Indrachapa/Documents/profileApp/profileApp1/node_modules/graphql/language/ast.js' implicitly has an 'any' type.
 Try `npm install @types/graphql` if it exists or add …
Run Code Online (Sandbox Code Playgroud)

javascript graphql angular aws-amplify

15
推荐指数
3
解决办法
3253
查看次数

在此文件夹中未检测到 Amplify 后端项目文件

如何解决“此文件夹中未检测到 Amplify 后端项目文件。初始化新的 Amplify 项目或提取现有项目”的问题 我在使用 Amplify 的 Windows 上总是遇到此问题。我正在关注 TindeClone,只是为了让我在休息后回到它,我得到“无法将后端附加到项目。确保没有应用程序锁定放大文件夹,然后重试”。这些问题让我感到沮丧,我该如何解决并继续前进。这是截图在此输入图像描述

感谢您的友好回复。

android react-native aws-amplify aws-amplify-cli

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