Skip to content
This repository has been archived by the owner on Sep 30, 2019. It is now read-only.

Incorrect string equality in VTL templates #160

Open
cyberwombat opened this issue Jul 23, 2019 · 1 comment
Open

Incorrect string equality in VTL templates #160

cyberwombat opened this issue Jul 23, 2019 · 1 comment

Comments

@cyberwombat
Copy link

I am wanting to compare strings and am unable to. Note that I am using serverless-appsync-offline but evidently it's just wrapping appsync-emulator-serverless.

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

@cyberwombat cyberwombat changed the title Incorrect string equality in templates Incorrect string equality in VTL templates Jul 23, 2019
@lightsofapollo
Copy link
Contributor

Thanks for reporting this! I will see if this is something we can fix quickly. I will note we will have an exciting announcement coming soon that should help this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants