vandium-io/vandium-node

vandium.validation (serverless-offline)

Closed this issue · 4 comments

Code :
https://github.com/vanerleo/offline-vandium-error

added vandium.validation({ to /test1/

when calling , /test1/?seoName=test and /test2
gives error on /test2 : {"errorMessage":"validation error: child \"seoName\" fails because [\"seoName\" is required]","errorType":"ValidationError","stackTrace":null}

while calling in reverse (/test2 and , /test1/?seoName=test ) is fine

Seems to be a problem with the require.cache not being flushed properly - not sure if this is a serverless-offline issue or a configuration problem. For now use the '--skipCacheInvalidation' with serverless-offline and use nodemon to reload.

updated the ./serve.sh , but it does not resolve the problem

dc00p commented

serverless-offline is not clearing it's require cache properly, therefore vandium is not getting reloaded, and the same vandium code is being used for all handlers.

The simplest solution is to use a different vandium install for each function.

Create a separate package.json for each function with vandium as a dependency, and do an "npm install" in each folder (you can script it if you like, but don't create a symlink back to a global node_modules).

WOW, thats crazy :)
i can confirm that your solution worked!
thank you for your support