gpt4 book ai didi

amazon-web-services - NativeScript AWS AppSync 集成

转载 作者:行者123 更新时间:2023-12-04 08:00:54 27 4
gpt4 key购买 nike

我已经学习了几个关于 Angular Web 的 AppSync 教程,但是尝试在 NativeScript 中重复这个过程更加困难。看起来像 people have done it before所以任何让这个工作的人的任何输入都会很棒。

按照我为常规 Angular Angular 应用程序所做的相同的一般程序,我尝试使用 aws-appsync 和 nativescript-nodeify 来尝试使其与 nativescript 兼容。添加 nativescript-nodeify 摆脱了我最初的错误,但现在我遇到了一个新错误:

我得到的错误是:

***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1 0x100b9373c NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool, bool)
2 0x100bc4068 -[TNSRuntime executeModule:referredBy:]
3 0x10056229c
4 0x184fcdfc0 <redacted>
JavaScript stack trace:
1 moduleDeclarationInstantiation@file:///app/tns_modules/aws-appsync/lib/link/non-terminating-link.js:71:26
2 link@[native code]
3 @[native code]
4 promiseReactionJob@[native code]
5 require@[native code]
6 anonymous@file:///app/tns_modules/aws-appsync/lib/link/non-terminating-link.js:71:26
7 evaluate@[native code]
8 moduleEvaluation@[native code]
9 @[native code]
10 promiseReactionJob@[native code]
11 require@[native code]
12 anonymous@file:///app/tns_modules/aws-appsync/lib/link/non-terminating-http-link.js:25:37
13 evaluate@[native code]
14 moduleEvaluation@[native code]
15 @[native code]
16 promiseReactionJob@[native code]
17 require@[native code]
18 anonymous@file:///app/tns_modules/aws-appsync/lib/link/index.js:21:42
19 evaluate@[native code]
20 moduleEvaluation@[native code]
21 @[native code]
22 promiseReactionJob@[native code]
23 require@[native code]
24 anonymous@file:///app/tns_modules/aws-appsync/lib/client.js:87:21
25 evaluate@[native code]
26 moduleEval<\M-b\M^@\M-&>
JavaScript error:
file:///app/tns_modules/aws-appsync/lib/link/non-terminating-link.js:71:26: JS ERROR SyntaxError: Importing binding name 'print' is not found.

我在初始化 AWSAppSyncConfig 时遇到错误。相关代码如下:

require('nativescript-nodeify');

const appSyncConfig = ...

import AWSAppSyncClient from 'aws-appsync';
import { AUTH_TYPE } from 'aws-appsync/lib/link/auth-link';

...

const client = new AWSAppSyncClient({
url: appSyncConfig.aws_appsync_graphqlEndpoint,
region: appSyncConfig.aws_appsync_region,
auth: {
type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
jwtToken: ACCESS_TOKEN
}
});

错误信息指向non-terminating-link.js中的这一行:

var linkUtils_1 = require("apollo-link/lib/linkUtils");

最佳答案

该问题最终与 typescript 2.9.* 和 aws-appsync 1.3.4 之间的兼容性问题有关。我将我的 typescript 更新到 3.0.3,它现在可以工作了

关于amazon-web-services - NativeScript AWS AppSync 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52451003/

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