Using Lambda with multiple handlers in AWS Step Functions


Using lambda function with multiple handlers is non-trivial in AWS Step Functions


Lambda is great; however one of the limitations is that only a single handler function is used.  Maintaining multiple lambda functions gets cumbersome quickly.

One common approach is to have a meta  handler that then routes to one of the sub-handlers; typically this is done by passing a name/reference to a handler to be used.

Now the problem arises when one wants to use meta-handlers  with AWS Step Functions.  In particular, it is not possible to edit the message (input/out) that is passed around states.

While editing message is not possible; one can alter it by moving different parts of it around.  It is a little bit tricky since one would have to use a combination of InputPath , ResultPath and OutputPath .  Currently a way to achieve is as following.

  "handlers": {
    "h1": {
      "name": "h1"
    "h2": {
      "name": "h2"
  "handler": {
    "name": "doMyThing"
  "details": {
    "path": "yourPath"

In your request include handlers that lists the ones that you are planning to use.

Then you you can add a pass state in the AWS Step Function’s State machine to select which of the handlers should be used; here is an example (selecting h1 to be used as a handler for the next state)

 "StartAt": "test",
 "States": {
 "test": {
 "Type": "Pass",
 "InputPath": "$.handlers.h1", 
 "ResultPath": "$.handler", 
 "OutputPath": "$",
 "End": true




Posted in Uncategorized | Leave a comment

Ordering Business Cards in Japan (Tokyo)

I spent about an hour (probably too much) looking at various options for ordering business cards in Japan.  Hopefully this post will save somebody a little bit of time.

There are quite a few companies that offer business card printing.  But after looking at variety of options; here are my (and in a way other bloggers) top choices.


Price: Very competitive price: 480 Y for 100 full colored cards (+ 200 Y for shipping) 1 week for delivery; I went for the 1 day option which was 1,500 Y (also quite reasonable) – (submitted data file at 11PM; cards were printed at noon of the next day; and delivered the on the next morning).

Great Interface: You can double check that the card looks fine through a very nice interface (p.s. I’ve used InkScape to design the card; and then uploaded pdf); you can easily track you submission etc.

Quality: Good

Choice for: For the best quality (offset printing) and numerous paper types.

Price: Reasonable (higher due to offset printing process)


Other Companies

I also looked at but didn’t like the submission interface; and overall the site wasn’t quite as easy to parse; besides I wanted to support local Japanese companies and I think VistaPrint is not one of them.


Other Reviews

These business card printer’s reviews were also quite useful












Posted in Uncategorized | Leave a comment

Food Delivery: Amazon Fresh in Japan

Typically Amazon enters market with a strong offering; however in the case of Amazon Fresh (recently launched in Japan) to me (as analyst and consumer) it is not clear what advantage Amazon Fresh provides in comparison with existing and mature Japanese companies (e.g. Pal System (web only store), Ito Yokado (regular store that also delivers) ).  Bellow is a very brief comparison (if you’d like a more detailed one; please get in touch with me).

Amazon Fresh :
monthly fee: $5
shipping fee: $5 for orders < $60
selection: probably wide; but is not quite clear yet

Ito Yokado (regular grocery store that also delivers)
monthly fee: free
shipping fee: $3 for orders < $20
selection: wide (many traditional Japanese grocery brands are available)

Pal System (web only store)
monthly fee: free
shipping fee: $2
selection: narrow (but focuses on organic and local food)

Amazon seems to have rather inferior offering (with the potential exception of the number of products available).  It is doubtful to me that the current offering will be successful; it will be interesting to see how it evolves.

Bellow is a very brief comparison (if you’d like a more detailed one; please get in touch with me).


Posted in Uncategorized | Leave a comment

Online SaaS Peer Assessment / Grading / Polling

Have spent several hours looking for a web-based tool that allows students to vote for each others presentations; by the best free solution was

(p.s. last year spent half a day counting students votes; so decided to automate it this year).

Posted in Uncategorized | Leave a comment

java.lang.NoSuchMethodError: com.amazonaws.transform.JsonErrorUnmarshaller: method (Ljava/lang/Class;)V not found


An exception or error caused a run to abort: com.amazonaws.transform.JsonErrorUnmarshaller

java.lang.NoSuchMethodError: com.amazonaws.transform.JsonErrorUnmarshaller: method <init>(Ljava/lang/Class;)V not found


AWS had some strangely maintained libraries for lambda

"com.amazonaws" % "aws-lambda-java-core" % AWSLambdaLibsVersion,
"com.amazonaws" % "aws-lambda-java-events" % AWSLambdaLibsVersion,
"1.1.0" //

The error was fixed by replacing above with:

"com.amazonaws" % "aws-java-sdk-lambda" % "1.11.109",


Posted in Uncategorized | Leave a comment

No compatible version found: @types/react-dom@15.4.2


Was puzzled by the

No compatible version found: @types/react-dom@15.4.2

In the end chaning all of the react related vers to


did the trick

also had an error (2nd one bellow); but that was due to a server already running on the same port


npm install
▌ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
▀ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
npm ERR! Linux 4.4.0-59-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2

npm ERR! No compatible version found: @types/react-dom@15.4.2
npm ERR! Valid install targets:
npm ERR! 0.14.21, 0.14.20, 0.14.19, 0.14.18, 0.14.17, 0.14.16, 0.14.15, 0.14.14, 0.14.13, 0.14.12-alpha, 0.14.11-alpha, 0.14.10-alpha, 0.14.9-alpha, 0.14.8-alpha, 0.14.7-alpha, 0.14.2-alpha, 0.14.1-alpha
npm ERR! 
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR! <>

npm ERR! Please include the following file with any support request:
npm ERR! /home/neil/MEGA/MEGAsync/docs/projects/patentBot/code/patentBotUI/npm-debug.log


npm start

> mobx-react-typescript-boilerplate@1.0.0 start /home/neil/MEGA/MEGAsync/docs/projects/patentBot/code/patentBotUI
> node server.js

 throw er; // Unhandled 'error' event

Error: listen EADDRINUSE
 at Object.exports._errnoException (util.js:870:11)
 at exports._exceptionWithHostPort (util.js:893:20)
 at Server._listen2 (net.js:1237:14)
 at listen (net.js:1273:10)
 at net.js:1382:9
 at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:63:16)
 at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:82:10)

npm ERR! Linux 4.4.0-59-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! mobx-react-typescript-boilerplate@1.0.0 start: `node server.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the mobx-react-typescript-boilerplate@1.0.0 start script 'node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the mobx-react-typescript-boilerplate package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs mobx-react-typescript-boilerplate
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls mobx-react-typescript-boilerplate
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/neil/MEGA/MEGAsync/docs/projects/patentBot/code/patentBotUI/npm-debug.log





Posted in Uncategorized | Leave a comment

React (TypeScript): infinite scroll

Recently I had to use an infinite scroll (lazy loading).  It took me a while to find a solution that worked well for my very simple case (lazy loading items in an infinite scroll fashion).  Hopefully this will save somebody time. ended up being by far the best solution that worked flawlessly  (and is extremely easy to use).  Just add it to the end of your scrollable list and lazy load once it becomes visible (p.s. you can move its position slightly upward to lazy load in a more eager manner):

    onChange={(isVisible) => isVisible ? this.loadMoreData() : console.log("debug: became invisible")}

p.s. make sure to use arrow functions otherwise you might have some problem with this binding etc.; more details:’this’-in-TypeScript#fixes

to avoid small amount of polling; you might also wan to set the `active` property to false; when your component is no longer visible.

Finally react-visibility-sensor could be used for other purposes other than infinite scroll – that requires to know whether your component is visible or not.


Other Libraries

Most of the problems with other libraries were due them estimating weather the component is visible or not based on the position of the scroll bar.  Some did by requiring you to specify the height of each of the component.  In part this was motivated by many of the infinite scroll packages aiming at the case were the number of items would be very large 10K+ (and would only keep a small portion of visible items; to improve memory usage).  In my case I had under 1,000 items (with images etc); so these types of solutions were not necessary.  None of the libraries bellow worked well for me (the firing events were not reliable).

Problem: didn’t update its position; so was stuck in the middle after more elements were added.


onEnter={() => console.log(“waypoint: on enter” )}
onLeave={() => console.log(“waypoint: on leave”)}
onPositionChange={() => console.log(“waypoint: on onPositionChange”)}

PROBLEM: `loadMore` often doesn’t fire 🙁

needed to `useWindow={false}` in order to get `loadMore` to fire


loadMore={() => console.log(“requested: loadMore ………………”)}
loader={<div className=”loader”>Loading …</div>}
(data) =>
<Item data={data} />

Other Notes

list for react:

Many of the infinite scroll libraries are aimed at efficiently rendering 1K+ results; that is not the case for me; since I mostly just need paging/on-demand fetching; so don’t need to add virualization managing (which complicates things).

a newer fork:
original (not updated for 3 years)

keywords: react simple non virtualized infinite scroll with page fetching loading lazy load



Other Notes

unrelated issue that I’ve experienced with is that having a property

height: window.innerHeight

would make the other component unresponsive/loose focus; removing that property fixed it.




Posted in Uncategorized | Leave a comment

ReactJS: Uncaught TypeError: Cannot read property of undefined


You get: Uncaught TypeError: Cannot read property of undefined

This is due to react trying to render components that rely on variables that haven’t yet been set (quite a common occurence).


You can use conditional rendering shortcut to get rid of this annoyance; this is possible due to react treating undefined as false; so you can then add the following:

{this.props.MyComponentsVar && <MyComponent />}

p.s. this will only be rendered if this.props.MyComponentsVar is defined



keywords: react

Posted in Uncategorized | Leave a comment

VM54310:600 Uncaught TypeError: _XXXXX2.default is not a constructor


VM54310:600 Uncaught TypeError: _XXXXX2.default is not a constructor


need to export default class e.g.:

export default class StateController { ...





keywords: typescript VM54310:600 Uncaught TypeError: _XXXXX2.default is not a constructor ts js webpack



Posted in Uncategorized | Leave a comment

Gradual Migration from JavaScript to TypeScript


You have an existing project in which you’d like to use TypeScript.


Simply remove the outDir from tsconfig.json, e.g.:

  "compilerOptions": {
         "allowJs": false,
    "outDir": "./tsDist/",
    "module": "es6",
    "target": "es6",
    "experimentalDecorators": true,
    "moduleResolution": "node"
  "exclude": [

Everything should work now (since ts file will be compiled to a JS file at the same location; so all the imports etc will work just fine).

Sometimes things get out of sync between ts and js files (might have something to do with IntelliJ); in that case I just manually execute tsc command.

Alternative approach didn’t work well for me; e.g. due to the 100+ errors that would need to be resolved (when I simply renamed the js -> ts files).

keywords: mixing ts js typescript javascript in the same project incremental


Posted in Uncategorized | Leave a comment