NativeScript AWS AppSync Integration


I’ve followed several AppSync tutorials for angular web, but trying to repeat the process in NativeScript has been more difficult. It looks like people have done it before so any input from anyone who has gotten this to work would be awesome.

Following the same general procedure I did for a regular angular angular app, I attempted to use aws-appsync and nativescript-nodeify to attempt to make it nativescript-compatible. Adding nativescript-nodeify got rid of my initial error, but now I’m getting a new error:

The error I’m getting is:

***** 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.

I’m getting an error when initializing AWSAppSyncConfig. The relevant code is below:


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: {
         jwtToken: ACCESS_TOKEN

The error message points to this line in non-terminating-link.js:

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

Extremely poor Apollo GraphQL support in Nativescript