Aws-mobile-appsync-sdk-js: Problem with v1.3.4 when using appsync on nodejs

Created on 21 Aug 2018  ·  12Comments  ·  Source: awslabs/aws-mobile-appsync-sdk-js

I'm using the appsync client on nodejs according to these instructions:
https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-node.html

v1.3.3 of the package worked fine, but the most recent version results in this error at runtime:

.../node_modules/apollo-link/lib/linkUtils.js:19
0|spfio-server | import { getOperationName } from 'apollo-utilities';
0|spfio-server | ^^^^^^
0|spfio-server | SyntaxError: Unexpected token import
0|spfio-server | at createScript (vm.js:80:10)
0|spfio-server | at Object.runInThisContext (vm.js:139:10)
0|spfio-server | at Module._compile (module.js:616:28)
0|spfio-server | at Object.Module._extensions..js (module.js:663:10)
0|spfio-server | at Module.load (module.js:565:32)
0|spfio-server | at tryModuleLoad (module.js:505:12)
0|spfio-server | at Function.Module._load (module.js:497:3)
0|spfio-server | at Module.require (module.js:596:17)
0|spfio-server | at require (internal/module.js:11:18)
0|spfio-server | at Object. (.../node_modules/aws-appsync/lib/link/non-terminating-link.js:71:19)

Most helpful comment

We have released this on latest ([email protected]) I will close the issue for now, but feel free to reopen if this error persist.

All 12 comments

The issue seems to have been introduced in https://github.com/awslabs/aws-mobile-appsync-sdk-js/commit/4d9175106dae9baa3b26db9d6bdfcfe898066a27#diff-e6bb1179240726bec8d81b929ddff4ecR10, which imports from (uncompiled) apollo-link internals.
Why apollo-link would publish es6 modules to NPM instead of commonjs modules is beyond me, but I'm pretty sure that's why it breaks.

Hey @manueliglesias and @joshbalfour 👋 Any insight into what happened?

Running into this same issue with a node.js lambda implementation using the AppSync client. Any word on a resolution?

Same issure, rolled back to 1.3.3

Same issue here in a Create React App app and rolling back to 1.3.3 alone did not fix it, also had to rollback aws-appsync-react to 1.1.3. Tons of my unit tests are failing with the new version.

  ● Test suite failed to run

    /Users/steven/Development/project/node_modules/apollo-link/lib/linkUtils.js:19
    import { getOperationName } from 'apollo-utilities';
    ^^^^^^

    SyntaxError: Unexpected token import

      at new Script (vm.js:51:7)
      at Object.<anonymous> (node_modules/aws-appsync/lib/link/non-terminating-link.js:71:19)

Hi,

I am changing the code that imports the uncompiled apollo-link pieces, can you try with an experimental build?

npm install aws-appsync@deepdish-next aws-appsync-react@deepdish-next

Hello, thank you for update - now its work

I'm still seeing this issue using the experimental build.

Hi I used:
npm install aws-appsync@deepdish-next
and it worked.

Neither of the solutions worked in my case.
As a temporary solution, I followed the following steps:
1) From the project root, run tsc node_modules/apollo-link/src/linkUtils.ts
2) then, run the other command mv node_modules/apollo-link/src/linkUtils.js node_modules/apollo-link/lib

Then running the project using npm run dev works just fine.

confirmed using aws-appsync@deepdish-next solved this issue

We have released this on latest ([email protected]) I will close the issue for now, but feel free to reopen if this error persist.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kabriel picture kabriel  ·  4Comments

yhenni1989 picture yhenni1989  ·  3Comments

peterservisbot picture peterservisbot  ·  3Comments

sfegsetsfe picture sfegsetsfe  ·  4Comments

wzup picture wzup  ·  3Comments