Git Product home page Git Product logo

serverless-appsync-offline's Introduction

serverless-appsync-offline

npm version License: MIT

This is a wrapper for the excellent AppSync Emulator.

Attention

Since the libraries from Conduit @conduitvc/appsync-emulator-serverless are no longer maintained this library cannot be maintained too. Please switch to serverless-appsync-simulator which wraps the offical AWS AppSync amplify-appsync-simulator.

This Plugin Requires

Features

  • Emulate Appsync with AppSync Emulator and depends on Serverless-AppSync-Plugin
  • Connect to any DynamoDB or install DynamoDB Local
  • Start DynamoDB Local with all the parameters supported (e.g port, inMemory, sharedDb)
  • Table Creation for DynamoDB Local

This plugin is updated by its users, I just do maintenance and ensure that PRs are relevant to the community. In other words, if you find a bug or want a new feature, please help us by becoming one of the contributors.

Install Plugin

npm install --save serverless-appsync-offline

Then in serverless.yml add following entry to the plugins array: serverless-appsync-offline

plugins:
  - serverless-appsync-offline

Using the Plugin

  1. Add Appsync Resource definitions to your Serverless configuration, as defined here: https://github.com/sid88in/serverless-appsync-plugin#configuring-the-plugin

Start appsync-offline

sls appsync-offline start

All CLI options are optional:

--port  		  -p  Port to provide the graphgl api. Default: dynamic
--dynamoDbPort            -d  Port to access the dynamoDB. Default: dynamic
--inMemory                -i  DynamoDB; will run in memory, instead of using a database file. When you stop DynamoDB;, none of the data will be saved. Note that you cannot specify both -dbPath and -inMemory at once.
--dbPath                  -b  The directory where DynamoDB will write its database file. If you do not specify this option, the file will be written to the current directory. Note that you cannot specify both -dbPath and -inMemory at once. For the path, current working directory is <projectroot>/node_modules/serverless-appsync-offline/dynamob. For example to create <projectroot>/node_modules/serverless-appsync-offline/dynamob/<mypath> you should specify -d <mypath>/ or --dbPath <mypath>/ with a forwardslash at the end.
--sharedDb                -h  DynamoDB will use a single database file, instead of using separate files for each credential and region. If you specify -sharedDb, all DynamoDB clients will interact with the same set of tables regardless of their region and credential configuration.
--delayTransientStatuses  -t  Causes DynamoDB to introduce delays for certain operations. DynamoDB can perform some tasks almost instantaneously, such as create/update/delete operations on tables and indexes; however, the actual DynamoDB service requires more time for these tasks. Setting this parameter helps DynamoDB simulate the behavior of the Amazon DynamoDB web service more closely. (Currently, this parameter introduces delays only for global secondary indexes that are in either CREATING or DELETING status.)
--optimizeDbBeforeStartup -o  Optimizes the underlying database tables before starting up DynamoDB on your computer. You must also specify -dbPath when you use this parameter.

All the above options can be added to serverless.yml to set default configuration: e.g.

Minimum Options:

custom:
  appsync-offline:
    port: 62222
    dynamodb:
      server:
        port: 8000

All Options:

custom:
  appsync-offline:
    port: 62222
    dynamodb:
      client:
        # if endpoint is provided, no local database server is started and and appsync connects to the endpoint - e.g. serverless-dynamodb-local
        endpoint: "http://localhost:8000"
        region: localhost
        accessKeyId: a
        secretAccessKey: a
      server:
        port: 8000
        dbPath: "./.dynamodb"
        inMemory: false,
        sharedDb: false,
        delayTransientStatuses: false,
        optimizeDbBeforeStartup: false,

How to Query:

curl -X POST \
  http://localhost:62222/graphql \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: APIKEY' \
  -d '{
	"query": "{ hello { world } }"
}'

Note: If you're using API_KEY as your authenticationType, then a x-api-key header has to be present in the request. The value of the key doesn't really matter.

Using DynamoDB Local in your code

You need to add the following parameters to the AWS NODE SDK dynamodb constructor

e.g. for dynamodb document client sdk

var AWS = require('aws-sdk');
new AWS.DynamoDB.DocumentClient({
    region: 'localhost',
    endpoint: 'http://localhost:8000'
})

e.g. for dynamodb document client sdk

new AWS.DynamoDB({
    region: 'localhost',
    endpoint: 'http://localhost:8000'
})

Using with serverless-offline plugin

When using this plugin with serverless-offline, it is difficult to use above syntax since the code should use DynamoDB Local for development, and use DynamoDB Online after provisioning in AWS. Therefore we suggest you to use serverless-dynamodb-client plugin in your code.

The serverless appsync-offline start command can be triggered automatically when using serverless-offline plugin.

Add both plugins to your serverless.yml file:

plugins:
  - serverless-appsync-offline
  - serverless-offline

Make sure that serverless-appsync-offline is above serverless-offline so it will be loaded earlier.

Now your local Appsync and the DynamoDB database will be automatically started before running serverless offline.

Debugging

SLS_DEBUG=* NODE_DEBUG=appsync-* yarn offline

or

SLS_DEBUG=* NODE_DEBUG=appsync-* yarn sls appsync-offline start

Using with serverless-offline and serverless-webpack plugin

Run serverless offline start. In comparison with serverless offline, the start command will fire an init and a end lifecycle hook which is needed for serverless-offline and serverless-appsync-offline to switch off both resources.

Add plugins to your serverless.yml file:

plugins:
  - serverless-webpack
  - serverless-appsync-offline
  - serverless-offline #serverless-offline needs to be last in the list

custom:
  appsync-emulator:
    # when using serverless-webpack it (by default) outputs all the build assets to `<projectRoot>/.webpack/service`
    # this will let appsync-offline know where to find those compiled files
    buildPrefix: .webpack/service

Notes

The AppSync Emulator does not support CloudFormation syntax (e.g. tableName: { Ref: UsersTable }) in dataSources.

License

MIT

serverless-appsync-offline's People

Contributors

aheissenberger avatar barendb avatar danifbento avatar davidclochard avatar daviskoh avatar jaydp17 avatar mattgibson avatar mystogab avatar ruban-gt avatar sebastianwahn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

serverless-appsync-offline's Issues

graphql-phone-type dependency issue when installing

I'm trying to install this package using this command:

npm install --save serverless-appsync-offline

However, it returns the following error:

Non-registry package missing package.json: graphql-phone-type@git+https://github.com/pianomansam/graphql-phone-type.git****

Attached below is the debug log that NPM has generated.
2019-05-02T10_34_33_827Z-debug.log

Edit:
Host: Ubuntu 18.04
NPM Version: 6.4.1
Node Version: v8.15.0
Note: NPM and Node has been installed using nvm version 0.34.0

Conflicting peer dependencies

The current version of serverless-appsync-offline has indirect dependencies that conflicts in their peer dependencies of graphql. npm install output extracted below,

npm WARN [email protected] requires a peer of graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.11.0 but none is installed. You must install peer dependencies yourself

I suggest updating graphql-* packages to at least those versions that depends on [email protected] for long term stability.

v1.2.X not published on npm

The latest version available on npm is 1.1.2.

It'd be great if you can publish the latest changes to npm.

Thanks :)

Preserve of service path

Good day! When you initialize the instance of appsync emulator you can pass wrong path of yml file, because other plugins (for example serverless-plugin-typescript) can mutate this.serverless object.

The real example with serverless-plugin-typescript:
For instance of ServerlessAppSyncPlugin in constructor the object gets original serverless.config.servicePath, but after hooks calling this object changes and servicePath gets path with new prefix (.build).
We can't know how the original object can changes, so I find simple solution: store the field with path in object properties:

In class constructor we'll add: this.servicePath = serverless.config.servicePath and this.serverless.config.servicePath callings we'll change to this.servicePath.

If it's good idea I can create the PR. Thank you!

Can I force the local API to run with SSL?

Is it possible to force the local API being run to run on ssl? It looks like the aws-amplify API client is forcing the socket to be done with wss instead of just ws, which is the protocol that was sent back to it from the API subscription request as shown in the images below. I am trying to run the front-end (React + Amplify manual setup) and back-end (Serverless + AppSync) locally simultaneously. I can query and run mutations just fine, but the subscriptions are not working. I get the same error when using the AwsAppSyncClient instead of the aws-amplify API client as well.

image

Here are the docs for what I am trying to accomplish. https://aws-amplify.github.io/docs/js/api#subscriptions

Here a simple version of my react code (without the react stuff)

import { API, graphqlOperation } from 'aws-amplify';
import gql from 'graphql-tag';

const mySubscription = gql`
    subscription {
        newEmployee {
            name
            id
            role
        }
    }
`;

API.graphql(graphqlOperation(mySubscription))
   .subscribe({
            next: (data) => {
                console.log("Incoming data", data)
            }
     });

Here it is with the AWSAppSyncClient

import AWSAppSyncClient, { AUTH_TYPE } from 'aws-appsync';

const client = new AWSAppSyncClient({
    url: "http://localhost:3002/graphql",
    region: 'us-west-2',
    auth: {
        type: AUTH_TYPE.API_KEY,
        apiKey: "xxxxxxxxxxxxx",
    }
});

const mySubscription = gql`
    subscription {
        newEmployee {
            name
            id
            role
        }
    }
`;

client.subscribe({
            query: mySubscription
        }).subscribe({
            next: data => {
                console.log("Retrieving data", data)
            },
            error: error => {
                console.error("Error in subscription", error);
            }
        })

and here is the result from using the AWSAppSyncClient
image

It could be that I just don't understand the subscriptions yet, but I believe this to be the issue. If the SSL issue is not the cause, could I get some help solving this?

Cannot install on windows

Hi, I'm trying to install this package on windows 10. I have tried npm install with powershell and git bash but I'm getting the following error:

> download --extract -o emulator https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.zip && ./install.sh

 "." is not recognized as an internal or external command, 
operable program or batch file.

Thanks!

Create new table for DynamoDB Local

Hey guys,

i'm using your plugin and use the DynamoDB local installation feature. It works wonderfully, but now, i'm wondering how can I create a new table in this local DDB, and add some data.

Could you help me ?

Thanks

Read schema file from serverless-appsync-plugin config

On my configuration for the serverless-appsync-plugin I have configured the schema to be read from graphql/schema.graphql but this plugin is not using that configuration, so I get the error ERROR: Error: schema file: /Users/kevinwolf/dev/gopato-cloud-services/schema.graphql must exist

appsync-emulator-serverless outdated

A few important bug corrections happened in appsync-emulator-serverless and this package is using a reasonably outdated version of it.

I have been using appsync-emulator-serverless v0.10.0 successfully. Would you consider updating the dependency version requirement?
I can submit the PR if you prefer.

Thanks

Multiple schema files isn't working

Hello,

i try to use multiple schema files, which have been implemented here to serverless-appsync-plugin : sid88in/serverless-appsync-plugin#227

But it doesn't work, it logs this : Serverless: ERROR: Error: schema file: /home/dclochard/workspace/cleo-api/schema.graphql must exist

Globally, when i just try to override schema file path (even when i use only one), i got the same error.

Any solution ?

Thanks, David

Publish 1.4.0

Hi there,

In a026ad5, you updated the semver for the appsync-emulator-serverless package to ^0.14.0 which is extremely valuable as this version contains a fix for flattening dataSource and mappingTemplate entries in the serverless configuration.

You had an additional commit to bump this package's version to 1.4.0 (714ca02) however, this was never actually published to npm (latest version published is still 1.3.3. This update would cut a ton of bloat from our current Serverless config. We're currently running on our own fork of this package to satisfy this dep requirement but it would be great if it could be published so we could stay in sync and not maintain a separate fork.

Thanks!

Mapping templates interpetration and Lambda execution

I'm having two issues. I have created a hello world graphql application. When deploying to remote appsync, I can see it's working correctly. But with sls-appsync-offline it seems that it's not interpreting well.

request mapping template:

{
    "version": "2017-02-28",
    "operation": "Invoke",
    "payload": {
        "type": "Query",
        "resolver": "helloWorld",
        "arguments":  $utils.toJson($context.arguments)
    }
}

Error:

{
  "errors": [
    {
      "message": "Cannot find function config for function : undefined",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "helloWorld"
      ]
    }
  ],
  "data": null
}

I tried to change the mapping template, and it seems it cannot parse it:

{
    "version": "2017-02-28",
    "operation": "Invoke",
    "payload": {
        "type": "Query",
        "resolver": "helloWorld",
        "arguments":  $utils.toJson($context.arguments),
        "handle" : $utils.toJson($context.identity.username)
    }
}

Error:

{
  "errors": [
    {
      "message": "JSON5: invalid character '$' at 8:20",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "helloWorld"
      ]
    }
  ],
  "data": null
}

Not using merged arrays from config file

This plugin is not using the full potential of appsync-emulator or appsync-plugin when it comes to merging an array of files in Mapping Templates. For example, if I have the following configuration:

  mappingTemplates:
    - ${file(notification-templates.yml)}
    - ${file(user-templates.yml)}

Appsync-emulator will resolve it properly and so will appsync-plugin. This is done by the loadServerlessConfig function in Appsync-emulator that is ignored when appsync-offline builds the server since it calls createServer passing this.serverless, instead of passing the path to the Serverless config file.

Here is how appsync-emulator calls it's own createServer function on bin/server.js

const serverless = path.join(path.dirname(pkgPath), 'serverless.yml');
const server = await createServer({ wsPort, serverless, port, dynamodb });

Because of this call, appsync-emulator calls loadServerlessConfig:

  if (typeof serverless === 'object') {
    serverlessConfig = serverless.service;
    serverlessDirectory = serverless.config.servicePath;
  } else {
    serverlessDirectory =
      typeof serverless === 'string'
        ? path.dirname(serverless)
        : findServerlessPath();
    const config = await loadServerlessConfig(serverlessDirectory); // This is called
    serverlessConfig = config.config;
  }

loadServerlessConfig does the flattening of the arrays:

const output = {
    config: {
      ...config,
      custom: {
        ...custom,
        appSync: {
          ...appSync,
          mappingTemplates: flatten(mappingTemplates),
          dataSources: flatten(dataSources),
        },
      },
      resources: normalizeResources(config),
    },
    directory: cwd,
  };

In order to avoid having to do the same in appsync-offline, I suggest simply calling appsync-emulator's createServer in the same way it calls itself. This would support the use case that both the other two plugins in this ecosystem support.

Does all this make sense? I can create a PR if you are willing to take this suggestion.

--Theo

fails to work with serverless-dynamodb-local

Having this plugin and serverless-dynamodb-local installed results in the DynamoDB installation failing. I have tried various versions of serverless-dynamodb-local and serverless-appsync-plugin with the same result.

Serverless: Invoke dynamodb:install
Started downloading Dynamodb-local. Process may take few minutes.
#

The last line is the terminal ready to accept input.

Installing error on windows

When I try to install the package I receive this error:

npm ERR! prepareGitDep 1>
npm ERR! prepareGitDep > [email protected] prepare C:\Users\Dell\AppData\Roaming\npm-cache_cacache\tmp\git-clone-5de1ad74
npm ERR! prepareGitDep > npm run clean && npm run lint && npm run build
npm ERR! prepareGitDep
npm ERR! prepareGitDep
npm ERR! prepareGitDep > [email protected] clean C:\Users\Dell\AppData\Roaming\npm-cache_cacache\tmp\git-clone-5de1ad74
npm ERR! prepareGitDep > rimraf lib dist es coverage
npm ERR! prepareGitDep
npm ERR! prepareGitDep
npm ERR! prepareGitDep > [email protected] lint C:\Users\Dell\AppData\Roaming\npm-cache_cacache\tmp\git-clone-5de1ad74
npm ERR! prepareGitDep > eslint src demo
npm ERR! prepareGitDep
npm ERR! prepareGitDep
npm ERR! prepareGitDep C:\Users\Dell\AppData\Roaming\npm-cache_cacache\tmp\git-clone-5de1ad74\src\index.js
npm ERR! prepareGitDep 1:65 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 2:66 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 3:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 4:60 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 5:31 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 6:30 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 7:91 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 8:4 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 9:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 10:47 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 11:25 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 12:54 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 13:4 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 14:18 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 15:78 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 16:4 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 17:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 18:16 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 19:3 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 20:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 21:58 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 22:30 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 23:43 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 24:12 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 25:12 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 26:19 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 27:28 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 28:22 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 29:29 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 30:16 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 31:11 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 32:40 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 33:9 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 34:29 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 35:22 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 36:29 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 37:16 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 38:11 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 39:40 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 40:9 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 41:51 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 42:8 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 43:4 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 44:2 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 45:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 46:33 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep
npm ERR! prepareGitDep C:\Users\Dell\AppData\Roaming\npm-cache_cacache\tmp\git-clone-5de1ad74\demo\index.js
npm ERR! prepareGitDep 1:31 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 2:39 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 3:31 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 4:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 5:23 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 6:40 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 7:98 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 8:4 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 9:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 10:30 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 11:10 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 12:18 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 13:5 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep
npm ERR! prepareGitDep C:\Users\Dell\AppData\Roaming\npm-cache_cacache\tmp\git-clone-5de1ad74\demo\schema.js
npm ERR! prepareGitDep 1:9 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 2:21 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 3:17 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 4:18 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 5:35 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 6:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 7:35 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 8:33 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 9:19 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 10:21 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 11:20 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 12:33 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 13:30 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 14:24 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 15:12 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 16:44 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 17:9 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 18:22 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 19:33 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 20:32 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 21:24 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 22:12 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 23:37 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 24:9 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 25:26 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 26:33 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 27:36 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 28:25 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 29:25 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 30:12 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 31:44 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 32:9 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 33:28 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 34:33 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 35:38 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 36:25 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 37:25 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 38:12 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 39:38 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 40:8 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 41:8 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 42:6 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 43:4 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep
npm ERR! prepareGitDep ✖ 102 problems (102 errors, 0 warnings)
npm ERR! prepareGitDep 102 errors, 0 warnings potentially fixable with the --fix option.
npm ERR! prepareGitDep
npm ERR! prepareGitDep
npm ERR! prepareGitDep 2> npm WARN install Usage of the --dev option is deprecated. Use --only=dev instead.
npm ERR! prepareGitDep npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! [email protected] lint: eslint src demo
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR!
npm ERR! prepareGitDep npm ERR! Failed at the [email protected] lint script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR! C:\Users\Dell\AppData\Roaming\npm-cache_logs\2019-01-22T19_22_13_278Z-debug.log
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! [email protected] prepare: npm run clean && npm run lint && npm run build
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR!
npm ERR! prepareGitDep npm ERR! Failed at the [email protected] prepare script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR! C:\Users\Dell\AppData\Roaming\npm-cache_logs\2019-01-22T19_22_13_360Z-debug.log
npm ERR! prepareGitDep
npm ERR! premature close

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dell\AppData\Roaming\npm-cache_logs\2019-01-22T19_22_14_072Z-debug.log
PS C:\Data\work\NinjaCuba\Code\ninjacuba_api> npm install serverless-appsync-offline
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t https://github.com/pianomansam/graphql-phone-type.git
npm ERR!
npm ERR! fatal: unable to access 'https://github.com/pianomansam/graphql-phone-type.git/': Unknown SSL protocol error in connection to github.com:443
npm ERR!
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dell\AppData\Roaming\npm-cache_logs\2019-01-22T20_11_37_498Z-debug.log
PS C:\Data\work\NinjaCuba\Code\ninjacuba_api> npm install serverless-appsync-offline
npm ERR! prepareGitDep 1>
npm ERR! prepareGitDep > [email protected] prepare C:\Users\Dell\AppData\Roaming\npm-cache_cacache\tmp\git-clone-fd0700ae
npm ERR! prepareGitDep > npm run clean && npm run lint && npm run build
npm ERR! prepareGitDep
npm ERR! prepareGitDep
npm ERR! prepareGitDep > [email protected] clean C:\Users\Dell\AppData\Roaming\npm-cache_cacache\tmp\git-clone-fd0700ae
npm ERR! prepareGitDep > rimraf lib dist es coverage
npm ERR! prepareGitDep
npm ERR! prepareGitDep
npm ERR! prepareGitDep > [email protected] lint C:\Users\Dell\AppData\Roaming\npm-cache_cacache\tmp\git-clone-fd0700ae
npm ERR! prepareGitDep > eslint src demo
npm ERR! prepareGitDep
npm ERR! prepareGitDep
npm ERR! prepareGitDep C:\Users\Dell\AppData\Roaming\npm-cache_cacache\tmp\git-clone-fd0700ae\src\index.js
npm ERR! prepareGitDep 1:65 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 2:66 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 3:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 4:60 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 5:31 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 6:30 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 7:91 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 8:4 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 9:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 10:47 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 11:25 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 12:54 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 13:4 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 14:18 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 15:78 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 16:4 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 17:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 18:16 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 19:3 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 20:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 21:58 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 22:30 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 23:43 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 24:12 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 25:12 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 26:19 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 27:28 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 28:22 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 29:29 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 30:16 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 31:11 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 32:40 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 33:9 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 34:29 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 35:22 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 36:29 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 37:16 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 38:11 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 39:40 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 40:9 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 41:51 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 42:8 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 43:4 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 44:2 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 45:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 46:33 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep
npm ERR! prepareGitDep C:\Users\Dell\AppData\Roaming\npm-cache_cacache\tmp\git-clone-fd0700ae\demo\index.js
npm ERR! prepareGitDep 1:31 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 2:39 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 3:31 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 4:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 5:23 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 6:40 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 7:98 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 8:4 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 9:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 10:30 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 11:10 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 12:18 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 13:5 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep
npm ERR! prepareGitDep C:\Users\Dell\AppData\Roaming\npm-cache_cacache\tmp\git-clone-fd0700ae\demo\schema.js
npm ERR! prepareGitDep 1:9 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 2:21 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 3:17 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 4:18 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 5:35 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 6:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 7:35 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 8:33 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 9:19 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 10:21 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 11:20 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 12:33 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 13:30 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 14:24 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 15:12 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 16:44 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 17:9 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 18:22 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 19:33 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 20:32 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 21:24 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 22:12 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 23:37 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 24:9 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 25:26 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 26:33 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 27:36 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 28:25 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 29:25 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 30:12 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 31:44 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 32:9 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 33:28 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 34:33 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 35:38 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 36:25 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 37:25 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 38:12 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 39:38 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 40:8 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 41:8 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 42:6 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep 43:4 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
npm ERR! prepareGitDep
npm ERR! prepareGitDep ✖ 102 problems (102 errors, 0 warnings)
npm ERR! prepareGitDep 102 errors, 0 warnings potentially fixable with the --fix option.
npm ERR! prepareGitDep
npm ERR! prepareGitDep
npm ERR! prepareGitDep 2> npm WARN install Usage of the --dev option is deprecated. Use --only=dev instead.
npm ERR! prepareGitDep npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! [email protected] lint: eslint src demo
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR!
npm ERR! prepareGitDep npm ERR! Failed at the [email protected] lint script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR! C:\Users\Dell\AppData\Roaming\npm-cache_logs\2019-01-22T20_12_47_408Z-debug.log
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! [email protected] prepare: npm run clean && npm run lint && npm run build
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR!
npm ERR! prepareGitDep npm ERR! Failed at the [email protected] prepare script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR! C:\Users\Dell\AppData\Roaming\npm-cache_logs\2019-01-22T20_12_47_510Z-debug.log
npm ERR! prepareGitDep
npm ERR! premature close

initialization errored: Unexpected token export

Hello,

I'm trying to run serverless-appsync-offline but I'm getting the following error:

"Serverless plugin "serverless-appsync-offline" initialization errored: Unexpected token export"

I already updated nodejs to v11.6.0 version and npm to 6.5.0-next.0

Do you have any idea why this is happening?

Unable to make it work with python and typescript project.

When trying to use this plugin with python or typescript projects, i am getting and error like this

{
  "errors": [
    {
      "message": "[object Object]",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "getSkillsInfo"
      ]
    }
  ],
  "data": {
    "getSkillsInfo": null
  }
}

issued query is

query getSkillsInfo($content: String = "need help with activation") {
  getSkillsInfo(content: $content) {
    content
    task_id
    timestamp
  }
}

Incorrect string equality in templates

I am wanting to compare strings and am unable to. Consider this example:

#set($foo = "a")
#set($bar = "a")

#if($foo == $bar) // Not the same
#if($foo == $bar.toString()) // The same
#if($foo.toString() == $bar) // The same

If I cast a single one then it matches?

I tried using the current version of velocityjs which appears to be the rendering engine and it works fine. Also someone tried it live on AWS and it works - just not when running locally.

My setup:

"serverless": "^1.47.0",
"serverless-appsync-offline": "^1.3.3",
"serverless-appsync-plugin": "^1.1.2",
"serverless-dynamodb-local": "^0.2.38",

My template:

#set($foo="a")
#set($bar="a")
#if($foo==$bar)
  same
#else
 not same
#end

I am loading this using SLS_DEBUG=* NODE_DEBUG=appsync-* yarn sls appsync-offline start and testing with graphiQL

How to fixed port of Websocket server?

Currently, the Appsync offline server run websocket with dynamic port that I can't use in Docker environment because I need know the Port and expose them to host.

So How to fixed port of Websocket server?

Lambda Resolvers

Hello, The README.md for serverless-appsync-plugin references this package here
It mentions support for Lambda Resolvers as well.

Therefore I was wondering;

  • Does this plugin support Lambda Resolvers?
  • If so would it be possible to update the README.md with a code example of plugging in a lambda resolver without the dynamodb.

My Specific use case for this is dealing with my current project's stack that goes
appsync -> serverless/Lambda -> Postgraphile -> PostgresQL

Thankyou

Quitting on Serverless 1.33

When running serverless appsync-offline start, ever since upgrading to Serverless 1.33, the command quits as soon as the GraphQL server comes up. From my logs, when using nodemon:

ℹ️  appsync-emulator:serverCore server bound { address: '::', family: 'IPv6', port: 62222 }
Serverless: AppSync started: http://localhost:62222/graphql
[nodemon] clean exit - waiting for changes before restart

You'll notice that while it exits cleanly, it doesn't do any of the cleanup. Otherwise we would see a line like AppSync offline - stopping graphql and dynamoDB.

I'm not sure if the bug is in this plugin or appsync-emulator-serverless.

Schema Stitching

Hello,

My serverless file uses schema stitching for clarity. But it seems is not supported:

Serverless: ERROR: Error: schema file: /<path>/schema.graphql must exist

Is there a workaround or going to be supported at any point?
Thank you

AppSync without GraphQL

Hi everyone!

We are looking to use AppSync with Lambda and without DynamoDB, we probably use DocumentDB/Mongo or Aurora. What is the best way to disable DynamoDB and not having it installed at all locally, while keeping serverless-appsync-plugin and serverless-appsync-offline working?

Cheers
M

Can't change schema file location.

I define my schema.graphql file under ./schema directory. On my serverless.yml file, it has

custom:
   appsync:
      name: ${self:provider.stackName}
      schema: 
         - ./schema/device.graphql
         - ./schema/schema.graphql
         - ./schema/transaction.graphql
         - ./schema/identity.graphql

when I run sls appsync-offline start, I got this error:

Serverless: AppSync Standalone
Serverless: dynamoDB started: http://localhost:62224/
Serverless: ERROR: Error: schema file: /Users/apps/schema.graphql must exist

It seems that it always look for schema.graphql under project root directory.

Connect to remote dynamoDB with Arn

  appsync-offline:
    port: 62222
    dynamodb:
      client:
        endpoint: "http://localhost:8000"
        region: us-east-1
        accessKeyId: "SDKFHKJSDKJHFSKDHFS"
        secretAccessKey: "SLDKJFSLKDFJSLDKFJLKSDFJ"

can the endpoint to be ARN for the dynamodb? instead of using offline dynamodb?

Serverless: ERROR: SchemaError: Expected `schema` to be an object or boolean

I think this is an error from appsync offline;

#46 same?

Serverless: ERROR: SchemaError: Expected ``schema`` to be an object or boolean

sls info

  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              12.8.1
     Framework Version:         2.18.0 (local)
     Plugin Version:            4.4.2
     SDK Version:               2.3.2
     Components Version:        3.4.6

I traced the error down into jsonvalidator/validator.js:

Validator.prototype.validate = function validate (instance, schema, options, ctx) {
  if((typeof schema !== 'boolean' && typeof schema !== 'object') || schema === null){
    console.log(`ERROR STARTING HERE`);
    console.log(typeof schema);
    console.log(schema);
    throw new SchemaError('Expected `schema` to be an object or boolean');
  }

The result of intercepting the error with console.log shows that that the validator is getting a string with the value "/Options", which is where I gave up for now.

AWS-Utils is deprecated

The folks over at https://github.com/ConduitVC/aws-utils have published the following depreciation notice...

AppSync Emulator Deprecation notice
We've worked with AWS over the last few months to transition ownership of the emulator directly into Amplify's (and AWS) hands.

Please see: https://www.linkedin.com/feed/update/urn:li:activity:6565000058121572352 for details. We will be deprecating the package shortly.

I know I'm fighting against the flow by not wanting to use amplify - but currently it is too limiting for my purpose; I think serverless-framework is a better fit for my needs... I wondered if you had any thoughts on how this impacts serverless-appsync-offline

ERROR: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object

Hi!

First of all thanks for doing this project,
well done.

We are setting up serverlesss-appsync-offline and only want to use lambdas as datasource.

I read the docs, but unfortunately I cannot find any simple example with serverless and lambda on the web to get us started. If you can help us out with this issue, we will happily contribute this back here. @aheissenberger

However we have run into the following problem:

terminal output:

$ sls appsync-offline start
Serverless: AppSync Standalone
Serverless: dynamoDB started: http://localhost:8000/
Serverless: ERROR: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object

with no working endpoint and the ERROR above.

or

$ sls offline
Serverless: Starting Offline: dev/us-west-2.

Serverless: Routes for graphql:
Serverless: (none)

Serverless: Offline listening on http://localhost:3000

with no route for graphql, respectively.

serverless.yml:

service: XXXXXXX-api

provider:
  name: aws
  runtime: nodejs8.10
  region: us-west-2
  stage: ${opt:stage, 'dev'} # Set the default stage used. Default is dev

plugins:
plugins:
  - serverless-dynamodb-local
  - serverless-appsync-plugin
  - serverless-appsync-offline
  - serverless-offline

functions:
  graphql:
    handler: handler.graphqlHandler

custom:
  appSync:
    name:  XXXXXXX-${self:provider.stage}-serverless
    region: ${self:provider.region}
    serviceRole: "${self:service.name}-AppSyncServiceRole"
    authenticationType: AMAZON_COGNITO_USER_POOLS
    userPoolConfig:
      defaultAction: ALLOW
      userPoolId: ********************
    mappingTemplatesLocation: # defaults to mapping-templates
    mappingTemplates:
      - type: Query
        dataSource: LambdaSource
        field: getPatients
        request: "query-getpatients-request.vtl"
        response: "common-response.vtl"
    dataSources:
      - type: AWS_LAMBDA
        name: LambdaSource
        description: "Lambda DataSource"
        config:
          functionName: graphql
          lambdaFunctionArn: { Fn::GetAtt: [GraphqlLambdaFunction, Arn] }
          serviceRoleArn: { Fn::GetAtt: [AppSyncLambdaServiceRole, Arn] }
  appsync-offline:
    port: 62222
    dynamodb:
      server:
        port: 8000

resources:
  - ${file(resources/appsync.yml)}

schema.graphql:

type Patient {
  id: ID!
  name: String!
}

type Query {
  getPatients: [Patient]
}

Any pointers very much appreciated!

Starts with No Errors/Warnings but have no access to endpoint

Hey guys,

Im running serverless-appsync-plugin, serverless-appsync-offline and serverless-offline.
When I run

serverless --stage local offline start --port 5000

Serverless runs and gives me a AppSync started: http://localhost:5000/graphql

But when i try to use it i get this error

{
  "statusCode": 404,
  "error": "Serverless-offline: route not found.",
  "currentRoute": "post - /graphql",
  "existingRoutes": []
}

any ideas.

Thanks

Support for pipeline resolvers

I am not sure if already supported but currently it does not seem to work.

    mappingTemplates:
      - dataSource: Messages
        type: Query
        field: getMessages
        request: "Query.getMessages-req.vtl"
        response: "Query.getMessages-res.vtl"
      - dataSource: Messages
        type: Query
        field: getMessage
        request: "Query.getMessage-req.vtl"
        response: "Query.getMessage-res.vtl"
      - type: Mutation
        field: createMessage
        request: "Wrap-req.vtl"
        response: "Wrap-res.vtl"
        kind: PIPELINE
        functions:
          - authFunction
          - createMessageFunction
    functionConfigurations:
      - dataSource: Auth
        name: authFunction
        request: "Auth-req.vtl"
        response: "Auth-res.vtl"
      - dataSource: Messages
        name: createMessageFunction
        request: "Mutation.createMessage-req.vtl"
        response: "Mutation.createMessage-res.vtl"

This is my configuration and it work online but not offline. The error is:

{
  "errors": [
    {
      "message": "Cannot read property 'name' of undefined",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "createMessage"
      ]
    }
  ],
  "data": null
}

Is it supposed to work? If not is there a plan on supporting it? If any other information is needed please let me know!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.