# Error message "Unable to get property 'getKeys' of undefined or null reference"

**URL:** <https://discourse.psychopy.org/t/error-message-unable-to-get-property-getkeys-of-undefined-or-null-reference/13250>\
**Category:** Online experiments\
**Created:** [May 11, 2020, 9:14pm UTC](https://discourse.psychopy.org/t/error-message-unable-to-get-property-getkeys-of-undefined-or-null-reference/13250 "2020-05-11T21:14:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![FvtW](https://avatars.discourse-cdn.com/v4/letter/f/85f322/32.png) [@FvtW](https://discourse.psychopy.org/u/FvtW)\
**Post date:** [May 11, 2020, 9:14pm UTC](https://discourse.psychopy.org/t/error-message-unable-to-get-property-getkeys-of-undefined-or-null-reference/13250/1 "2020-05-11T21:14:39Z")

</div>

Hi, I’ve programmed an experiment which runs fine offline, but when running it on Pavlovia I get an error message for a keyboard response (see picture). The participant has to input a letter to indicate their sex (m, f or p). This works fine offline, but on Pavlovia I get an error message that says: "Unable to get property ‘getKeys’ of undefined or null reference.

I don’t understand why it won’t work. Any ideas? Thanks!!!

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/3/b/3b935b39c20bbb45551988dcd57f6f549380dea8.png)

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [May 11, 2020, 9:48pm UTC](https://discourse.psychopy.org/t/error-message-unable-to-get-property-getkeys-of-undefined-or-null-reference/13250/2 "2020-05-11T21:48:30Z")

</div>

You need to put **event=psychoJS.eventManager;** in a JavaScript code block at the start of your experiment.

> **[PsychoPy Python to Javascript crib sheet](https://docs.google.com/document/d/13jp0QAqQeFlYSjeZS0fDInvgaDzBXjGQNe4VNKbbNHQ/edit?usp=sharing)**
>
> PsychoPy Python to Javascript crib sheet Compiled by Wakefield Morys-Carter, Oxford Brookes University PsychoPy 2020 has an automatic Python to Javascript translation tool. This document contains information about code that is not translated...

Best wishes,

Wakefield
