serverless-appsync/serverless-appsync-simulator

AppSync Simulator: TypeError: FnSplit is not a constructor

Closed this issue · 7 comments

Describe the bug
Unable to start appsync in local using this plugin.

getting error like this

AppSync Simulator: TypeError: FnSplit is not a constructor

using these packages

"serverless-appsync-simulator": "^0.3.4",
"serverless-offline": "^5.12.1",
"serverless-appsync-plugin": "1.1.2",
"serverless": "^1.61.2",

added in plugin sections like this

plugins:
  - serverless-webpack
  - serverless-appsync-simulator
  - serverless-offline

Screenshot 2020-01-17 at 12 17 15 PM

@chaitanya11 I suspect this is related to the dependency cfn-resolver-lib
Are you using the Cfn FnSplit function somewhere in your yaml file?

@bboure Yeah i am using that function, is that a problem? if so, can you suggest some alternative ?

@chaitanya11 Can you point out where you are using it and how in your yaml?
Maybe there is an alternative out a workaround for it.
Otherwise I guess you could also open an issue at https://github.com/robessog/cfn-resolver-lib to add support for it.

@bboure i am using to attach subnetids to lambda function like bellow

rasaNlu:
  handler: src/api/rasa.rasaNlu
  timeout: 30
  layers:
    - ${opt:dhxds-layer}
  vpc:
    securityGroupIds:
      - ${opt:securityGroupId}
    subnetIds:
      "Fn::Split":
      - ","
      - ${opt:subnetIds}

@chaitanya11 this is a bug in https://github.com/robessog/cfn-resolver-lib
The simulator does not need the vpc options, but it tries to parse the functions config in order to extract the function handlers. This is when the issue happens.

A lame workaround for now would be to comment out those lines when running the simulator.

AN issue should probably be opened on https://github.com/robessog/cfn-resolver-lib in order either implement the Fn:: Split function and/or to ignore unknown functions.

Thanks a lot @bboure .

@chaitanya11 FYI, This was solved apparently
robessog/cfn-resolver-lib#24