Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin not working as expected after update depedencies #186

Closed
tttaisgt opened this issue Jun 15, 2023 · 1 comment
Closed

plugin not working as expected after update depedencies #186

tttaisgt opened this issue Jun 15, 2023 · 1 comment

Comments

@tttaisgt
Copy link

tttaisgt commented Jun 15, 2023

Describe the bug
I'm using serverless-appsync-simulator with serverless-offline and serverless-appsync-plugin to simulate appsync(graphql) in local env

but after updated serverless-offline from v7.0.0 to the latest version(because I upgrade nodejs version from 14.x->18.x and the old version of serverless-offline not support it), the simulator not working anymore, all the response is null and sometimes cause an error

To Reproduce

  • run sls offline start --host 0.0.0.0
  • go to GraphiQL screen
  • make a request

Expected behavior
It can work normally

Screenshots
image
image

Additional context
Sample Code

  • file: serverless.yml
frameworkVersion: '3'
service: my-service

provider:
  runtime: nodejs18.x
  stage: dev

functions:
  main:
    handler: handler.main

appSync:
  name: Appsync
  authenticationType: API_KEY
  lambdaAuthorizerConfig:
      functionName: appsync-auth
  schema: ${file(./conf/schema.yml)}
  dataSources:
    - type: AWS_LAMBDA
          name: main
          description: 'Lambda DataSource'
          config:
            functionName: main
            iamRoleStatements:
              - Effect: "Allow"
                Action:
                  - "lambda:invokeFunction"
                Resource:
                  - "*"
  defaultMappingTemplates:
      request: false
      response: false
   mappingTemplates:
      - dataSource: main
        type: Query
        field: getData

appsync-simulator:
    watch: false
    port: 3000
    apiKey: da2-fakeApiId123456

plugins:
  - serverless-layers
  - serverless-appsync-plugin
  - serverless-appsync-simulator
  - serverless-offline
  - serverless-offline-direct-lambda
  - serverless-step-functions
  • file: handler.js
'use strict'

const { stringify } = JSON

exports.main = async function main() {
          callback(null, await controller.getData(event.arguments.request, event.info.selectionSetList));
}
  • file: controller
getData(request) {
  result = # process request...
  return { data: result };
}
  • file: data.graphql
type Query {
    getData(id:Int!):Data
}

type Data {
    id:Int
    name:String
    type:String
    created_at:AWSDateTime
    deleted:Boolean
    updated_at:AWSDateTime
}

Environment

  • serverless: v3.31.0
  • serverless-offline: v12.0.4
  • serverless-appsync-simulator: v0.20.0
  • node.js version: nodejs18.x
  • OS: macOS monterey 12.6.5
@plezan
Copy link
Collaborator

plezan commented Jan 24, 2024

Sorry for the late answer, it looks like the same issue as #178 :
The v0.20 of this plugin is not compatible with serverless-appsync-plugin v2

We just released a new beta version that added support for node >= 18 and that should fix your issue

@plezan plezan closed this as completed Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants