# Can't merely import AWS amplify or aws appsync

**URL:** <https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914>\
**Category:** StealJS\
**Created:** [June 18, 2018, 2:18pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914 "2018-06-18T14:18:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![janat08](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@janat08](https://forums.bitovi.com/u/janat08)\
**Post date:** [June 18, 2018, 2:18pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/1 "2018-06-18T14:18:06Z")

</div>

Upon importing either of the libraries compiler throws errors. I believe both of them expect util package to be installed (appsync definitely does)  
Amplify- [https://www.npmjs.com/package/aws-amplify:](https://www.npmjs.com/package/aws-amplify:)

```auto
import Amplify from 'aws-amplify';

```

```auto
AssertionError [ERR_ASSERTION]: loading or loaded
    at Console.assert (console.js:194:23)
    at C:\Users\janat08\Dev\makpal\node_modules\steal\src\loader\loader-sans-promises.js:236:17
    at

```

appsync - [https://www.npmjs.com/package/aws-appsync:](https://www.npmjs.com/package/aws-appsync:)

```auto
import AWSAppSyncClient from 'aws-appsync'

```

```auto
Error compiling
The load aws-appsync@1.0.23#lib/index already failed.

```

---

<div class="post-metadata">

**Author:** ![janat08](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@janat08](https://forums.bitovi.com/u/janat08)\
**Post date:** [June 18, 2018, 2:29pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/2 "2018-06-18T14:29:34Z")

</div>

I guess that the issue there is dependency on util package that tries to bring node’s util to browser which steal doesn’t accept.

---

<div class="post-metadata">

**Author:** ![janat08](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@janat08](https://forums.bitovi.com/u/janat08)\
**Post date:** [June 19, 2018, 12:35pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/3 "2018-06-19T12:35:54Z")

</div>

aws-appsync exports a module under the same name used above which will also not work. Justin mentioned [https://github.com/stealjs/node-browser-builtins](https://github.com/stealjs/node-browser-builtins) as way to replace util

---

<div class="post-metadata">

**Author:** ![justinbmeyer](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/justinbmeyer/32/179_2.png) [@justinbmeyer](https://forums.bitovi.com/u/justinbmeyer)\
**Post date:** [June 19, 2018, 12:36pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/4 "2018-06-19T12:36:52Z")

</div>

The error you are seeing happens during a `steal-tools` build or during the app loading dynamically with `steal.js`?

---

<div class="post-metadata">

**Author:** ![janat08](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@janat08](https://forums.bitovi.com/u/janat08)\
**Post date:** [June 19, 2018, 12:37pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/5 "2018-06-19T12:37:54Z")

</div>

donejs develop… how do you tell those apart?

---

<div class="post-metadata">

**Author:** ![justinbmeyer](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/justinbmeyer/32/179_2.png) [@justinbmeyer](https://forums.bitovi.com/u/justinbmeyer)\
**Post date:** [June 19, 2018, 12:39pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/6 "2018-06-19T12:39:17Z")

</div>

Did the error happen while running `steal-tools` to build the app into one or more minified bundles? Or, are you just opening a development page and having steal load each file individually?

---

<div class="post-metadata">

**Author:** ![janat08](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@janat08](https://forums.bitovi.com/u/janat08)\
**Post date:** [June 19, 2018, 12:40pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/7 "2018-06-19T12:40:18Z")

</div>

I belief development, if youre referring to donejs develop or build.

---

<div class="post-metadata">

**Author:** ![janat08](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@janat08](https://forums.bitovi.com/u/janat08)\
**Post date:** [June 19, 2018, 1:05pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/8 "2018-06-19T13:05:18Z")

</div>

Did in dependencies of package.js after installing steal-builtins  
“util”: “steal-builtins/builtin/util.js’”  
Get the error:

```auto
Error: Could not load 'util@steal-builtins/builtin/util.js'#index'
Is this an npm module not saved in your package.json?
    at file:C:/Users/janat08/Dev/makpal/node_modules/steal/ext/npm-extension.js:379:20
    at C:\Users\janat08\Dev\makpal\node_modules\can-zone\lib\tasks.js:166:15
    at Task.run (C:\Users\janat08\Dev\makpal\node_modules\can-zone\lib\zone.js:38:17)
    at Zone.runTask (C:\Users\janat08\Dev\makpal\node_modules\can-zone\lib\zone.js:181:14)
    at C:\Users\janat08\Dev\makpal\node_modules\can-zone\lib\zone.js:282:15
    at C:\Users\janat08\Dev\makpal\node_modules\can-zone\lib\tasks.js:177:21
    at 

```

---

<div class="post-metadata">

**Author:** ![janat08](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@janat08](https://forums.bitovi.com/u/janat08)\
**Post date:** [June 19, 2018, 1:10pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/9 "2018-06-19T13:10:02Z")

</div>

It appears to want to access index of that file, and contrary to documentation you indeed have to access steal-builtins.

---

<div class="post-metadata">

**Author:** ![matthewp](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/matthewp/32/77_2.png) [@matthewp](https://forums.bitovi.com/u/matthewp)\
**Post date:** [June 19, 2018, 1:43pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/10 "2018-06-19T13:43:46Z")

</div>

It’s a bug, filed here: [https://github.com/stealjs/steal/issues/1428](https://github.com/stealjs/steal/issues/1428)

Should be an easy fix I think. Let’s take the discussion there.

---

<div class="post-metadata">

**Author:** ![matthewp](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/matthewp/32/77_2.png) [@matthewp](https://forums.bitovi.com/u/matthewp)\
**Post date:** [June 19, 2018, 3:40pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/11 "2018-06-19T15:40:14Z")

</div>

Fixed in steal 1.12.2

---

<div class="post-metadata">

**Author:** ![janat08](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@janat08](https://forums.bitovi.com/u/janat08)\
**Post date:** [June 20, 2018, 11:21am UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/12 "2018-06-20T11:21:21Z")

</div>

btw imports still don’t work. They produce 404 errors for all of the modules of aws-amplify.

---

<div class="post-metadata">

**Author:** ![janat08](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@janat08](https://forums.bitovi.com/u/janat08)\
**Post date:** [June 20, 2018, 11:24am UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/13 "2018-06-20T11:24:58Z")

</div>

```auto
GET http://localhost:8080/node_modules/aws-amplify/lib/Cache.js 404 (Not Found)
Error: 0 : http://localhost:8080/node_modules/aws-amplify/lib/Analytics.js

The module [aws-amplify/lib/Analytics] couldn't be fetched.
Clicking the link in the stack trace below takes you to the import.
See https://stealjs.com/docs/StealJS.error-messages.html#404-not-found for more information.

  13 | */
  14 | Object.defineProperty(exports, "__esModule", { value: true });
> 15 | var Analytics_1 = require("./Analytics");
     | ^
  16 | exports.Analytics = Analytics_1.default;
  17 | exports.AnalyticsClass = Analytics_1.AnalyticsClass;
  18 | exports.AWSPinpointProvider = Analytics_1.AWSPinpointProvider;

    at (:8080/node_modules/aws-amplify/lib/index.js:15)

```

---

<div class="post-metadata">

**Author:** ![janat08](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@janat08](https://forums.bitovi.com/u/janat08)\
**Post date:** [June 20, 2018, 8:13pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/14 "2018-06-20T20:13:32Z")

</div>

reading the doc, it’s not that the package is missing form package.json, and I’m importing the default export with like 10 404s popping up for its’ properties.

---

<div class="post-metadata">

**Author:** ![janat08](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@janat08](https://forums.bitovi.com/u/janat08)\
**Post date:** [June 20, 2018, 8:14pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/15 "2018-06-20T20:14:29Z")

</div>

@matthewp would you look at it?

---

<div class="post-metadata">

**Author:** ![matthewp](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/matthewp/32/77_2.png) [@matthewp](https://forums.bitovi.com/u/matthewp)\
**Post date:** [June 20, 2018, 8:20pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/16 "2018-06-20T20:20:35Z")

</div>

This seems to work fine: [https://gist.github.com/matthewp/48c384bde6e2c0517a15c44312958ff1](https://gist.github.com/matthewp/48c384bde6e2c0517a15c44312958ff1)

---

<div class="post-metadata">

**Author:** ![janat08](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@janat08](https://forums.bitovi.com/u/janat08)\
**Post date:** [June 20, 2018, 10:36pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/17 "2018-06-20T22:36:01Z")

</div>

if you generate a project with donejs, than that happens.

---

<div class="post-metadata">

**Author:** ![janat08](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@janat08](https://forums.bitovi.com/u/janat08)\
**Post date:** [June 20, 2018, 10:36pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/18 "2018-06-20T22:36:42Z")

</div>

on windows at least.

package.json

```auto
{
  "name": "aws",
  "version": "0.0.0",
  "description": "An awesome DoneJS app",
  "homepage": "",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/donejs-user/aws.git"
  },
  "author": {
    "name": "zhan",
    "email": "jey.and.key@gmail.com",
    "url": "https://donejs.com"
  },
  "private": true,
  "scripts": {
    "test": "testee test.html --browsers firefox --reporter Spec",
    "start": "done-serve --port 8080",
    "develop": "done-serve --develop --port 8080",
    "build": "node build"
  },
  "main": "aws/index.stache!done-autorender",
  "files": [
    "src"
  ],
  "keywords": [
    "",
    "donejs-app"
  ],
  "steal": {
    "main": "aws/index.stache!done-autorender",
    "directories": {
      "lib": "src"
    },
    "configDependencies": [
      "live-reload",
      "node_modules/can-zone/register",
      "node_modules/steal-conditional/conditional"
    ],
    "plugins": [
      "done-css",
      "done-component",
      "steal-less",
      "steal-stache"
    ],
    "envs": {
      "server-production": {
        "renderingBaseURL": "/dist"
      }
    },
    "serviceBaseURL": ""
  },
  "dependencies": {
    "aws-amplify": "^0.4.5",
    "can-component": "^4.0.2",
    "can-connect": "^2.0.2",
    "can-define": "^2.0.1",
    "can-route": "^4.1.0",
    "can-route-pushstate": "^4.0.1",
    "can-set": "^1.5.1",
    "can-stache": "^4.1.0",
    "can-stache-route-helpers": "<2.0.0",
    "can-view-autorender": "^4.0.0",
    "can-zone": "^0.6.13",
    "done-autorender": "^2.0.0",
    "done-component": "^2.0.0",
    "done-css": "^3.0.2",
    "done-serve": "^2.0.0",
    "generator-donejs": "^2.1.0",
    "steal": "^1.6.5",
    "steal-less": "^1.2.2",
    "steal-stache": "^4.0.1"
  },
  "devDependencies": {
    "can-debug": "^1.0.0",
    "can-fixture": "^2.0.2",
    "donejs-cli": "^2.0.0",
    "funcunit": "^3.2.0",
    "steal-conditional": "^1.0.0",
    "steal-qunit": "^1.0.1",
    "steal-tools": "^1.11.3",
    "testee": "^0.7.0"
  },
  "license": "MIT"
}

```

---

<div class="post-metadata">

**Author:** ![matthewp](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/matthewp/32/77_2.png) [@matthewp](https://forums.bitovi.com/u/matthewp)\
**Post date:** [June 20, 2018, 11:50pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/19 "2018-06-20T23:50:10Z")

</div>

Ok, I’ll investigate tomorrow

---

<div class="post-metadata">

**Author:** ![matthewp](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/matthewp/32/77_2.png) [@matthewp](https://forums.bitovi.com/u/matthewp)\
**Post date:** [June 21, 2018, 12:32pm UTC](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914/20 "2018-06-21T12:32:41Z")

</div>

Here’s an example project where this is working: [https://github.com/donejs/donejs-amplify-example-project](https://github.com/donejs/donejs-amplify-example-project)

If you are seeing something different let me know.

[Next page](https://forums.bitovi.com/t/cant-merely-import-aws-amplify-or-aws-appsync/914.md?page=2)
