Git Product home page Git Product logo

flex-sdk's People

Contributors

alexanderfilipov avatar amoothart avatar dependabot[bot] avatar dimofeev avatar echoabstract avatar galniv avatar gprodanov avatar janssenivo avatar mjsalinger avatar mkapostolov avatar tsvetomir-nedyalkov avatar ventsislav-georgiev avatar wkkim-se avatar wongni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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

flex-sdk's Issues

What's the best way to unit test a flex function?

Hi,

I am developing a few flex functions using flex-sdk. For now, I am running a local server using 'node .' and sending requests using PostMan. However, it's pretty manual process. I'd like to know if there is any best practice to automate unit or functional testing for those flex functions.

package.json node engines config needs to be updated

Now that FlexService supports multiple Node runtimes, the package.json engines config should be updated to reflect this. Currently it is set to node 6.x.x only, but 8.x and 10.x are now supported by Flex.

When using yarnpkg / yarn (instead of npm) it will fail when trying to install the kinvey-flex-sdk module.

Current:
"engines": { "node": "=6.x.x" }

Proposed:
"engines": { "node": "=6.x.x||=8.x.x||=10.x.x" }

If anyone is having this issue, the work around is to pass --ignore-engines argument to yarn.

Flex functions are not working locally

After registering a function they are not visible, neither locally or when deployed in Kinvey.
Seems the Express param routing names are not matching for the flex functions when running locally (:handlerName vs objectName)?.
Also the X-Kinvey.. headers does not seem to get picked up

roleStore should have more query flexibility

I was attempting to get a role's ID by its name through roleStore, but found myself unable to do so directly. Most "store" modules have a "find(query, callback)" function, but roleStore seems to lack this. It'd be nice if roleStore implemented a "find(query, callback)" method and/or a "list()" method (that returns all roles).

kinvey flex deploy: should run a check and fail if the code is invalid

When I run kinvey flex deploy, while my JavaScript is broken the deploy command still pushes the code to Kinvey, which then breaks my cloud code.

Instead it would be great if the deploy command could run some basic validations and throw an error, stopping me from sending the invalid code.

For example, in my code I was trying to submit code like:

export const myFunction = (context, complete, modules) => {
  complete().setBody([1, 2, 3]).done();
}

However, when I run node ., node will complain about the use of export and fail.
But kinvey flex deploy doesn't complain and is happy to push the invalid code.

BLUnsupportedBodyType error when deployed with [email protected]

Hi,

I just deployed my flex functions after updating flex-sdk to 2.0.0. Ever since, I got the following error when I access any of my flex functions.

{"error":"BLUnsupportedBodyType","description":"The request and response bodies returned from your Business Logic script must contain a valid JSON object.","debug":"Your 'request' object contained a body that is not a JSON object"}

It seems working well when I test them locally with PostMAN but I noticed one difference. As you see below (highlighted), request body was an object with 1.2.0 and is a string with 2.0.0. I think this causes the error from the deployed flex functions.

  1. With 1.2.0
    {
    "request": {
    "method": "POST",
    "headers": {
    "authorization": "Kinvey eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3N0YWdpbmctZW5lcmd5Y3VyYi5hdXRoMC5jb20vIiwic3ViIjoiZFRzeDU4UHNZYkljR2FTMzRxVGZlZTkweGtXT2NBa3dAY2xpZW50cyIsImF1ZCI6ImFwaS5zdGFnaW5nLmVuZXJneWN1cmIuY29tIiwiZXhwIjoxNDg3ODk5OTI5LCJpYXQiOjE0ODc4NjM5MjksInNjb3BlIjoicHV0OmNsYW1wIGdldDpjbGFtcCBnZXQ6Y2xhbXBzIHB1dDpodWIgZ2V0Omh1YiBnZXQ6aHVicyBkZWxldGU6Y2lyY3VpdCBwdXQ6Y2lyY3VpdCBwb3N0OmNpcmN1aXQgZ2V0OmNpcmN1aXQgZ2V0OmNpcmN1aXRzIGRlbGV0ZTpicmVha2VyIHB1dDpicmVha2VyIHBvc3Q6YnJlYWtlciBnZXQ6YnJlYWtlciBnZXQ6YnJlYWtlcnMgZGVsZXRlOnBhbmVsIHB1dDpwYW5lbCBwb3Q6cGFuZWwgZ2V0OnBhbmVsIGdldDpwYW5lbHMgZGVsZXRlOmxvY2F0aW9uIHB1dDpsb2NhdGlvbiBwb3N0OmxvY2F0aW9uIGdldDpsb2NhdGlvbnMgZ2V0OmxvY2F0aW9uIn0.xw6-xBJ00pa8QHQtDIlOk6qJn8nQTsLQXDHdIbxfTKc"
    },
    "username": "[email protected]",
    "userId": "58176f1c89dafe7123e78944",
    "objectName": "",
    "body": {
      "locationId": "58827e25ee1e6f71497f2283",
      "email": "[email protected]",
      "transferType": "to_home_owner"
    }

},
"response": {
"status": 0,
"headers": {},
"body": {
"error": "FlexRuntimeError",
"description": "The Flex Service had a runtime error. See debug message for details",
"debug": {
"message": "location not found for 58827e25ee1e6f71497f2283"
}
},
"statusCode": 550,
"continue": false
}
}

  1. With 2.0.0
    {
    "request": {
    "method": "POST",
    "headers": {
    "authorization": "Kinvey eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3N0YWdpbmctZW5lcmd5Y3VyYi5hdXRoMC5jb20vIiwic3ViIjoiZFRzeDU4UHNZYkljR2FTMzRxVGZlZTkweGtXT2NBa3dAY2xpZW50cyIsImF1ZCI6ImFwaS5zdGFnaW5nLmVuZXJneWN1cmIuY29tIiwiZXhwIjoxNDg3ODk5OTI5LCJpYXQiOjE0ODc4NjM5MjksInNjb3BlIjoicHV0OmNsYW1wIGdldDpjbGFtcCBnZXQ6Y2xhbXBzIHB1dDpodWIgZ2V0Omh1YiBnZXQ6aHVicyBkZWxldGU6Y2lyY3VpdCBwdXQ6Y2lyY3VpdCBwb3N0OmNpcmN1aXQgZ2V0OmNpcmN1aXQgZ2V0OmNpcmN1aXRzIGRlbGV0ZTpicmVha2VyIHB1dDpicmVha2VyIHBvc3Q6YnJlYWtlciBnZXQ6YnJlYWtlciBnZXQ6YnJlYWtlcnMgZGVsZXRlOnBhbmVsIHB1dDpwYW5lbCBwb3Q6cGFuZWwgZ2V0OnBhbmVsIGdldDpwYW5lbHMgZGVsZXRlOmxvY2F0aW9uIHB1dDpsb2NhdGlvbiBwb3N0OmxvY2F0aW9uIGdldDpsb2NhdGlvbnMgZ2V0OmxvY2F0aW9uIn0.xw6-xBJ00pa8QHQtDIlOk6qJn8nQTsLQXDHdIbxfTKc"
    },
    "username": "[email protected]",
    "userId": "58176f1c89dafe7123e78944",
    "objectName": "",
    "body": "{\"locationId\":\"58827e25ee1e6f71497f2283\",\"email\":\"[email protected]\",\"transferType\":\"to_home_owner\"}"
    "response": {
    "status": 0,
    "headers": {},
    "body": {
    "error": "FlexRuntimeError",
    "description": "The Flex Service had a runtime error. See debug message for details",
    "debug": {
    "message": "location not found for 58827e25ee1e6f71497f2283"
    }
    },
    "statusCode": 550,
    "continue": false
    }
    }

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.