correctly parse payload and catch possible errors for node

correctly parse payload and catch possible errors for node