Incorrect API key gives confusing error message

Hi,

Not entirely sure how, but I got my API key off by one in my emonhub config file.

When this happens you get the confusing:

emonCMS send failure: wanted 'ok' but got '
Notice: Undefined index: userid in /var/www/emoncms/index.php on line 109
'

Cheers,

Tim.

pb66's picture

Re: Incorrect API key gives confusing error message

Hi Tim, I can see the message could ideally be clearer, sometimes they can be a bit cryptic due to the wide range of possible messages. In this instance "emonCMS" refers to the reporter named emoncms within emonhub since we're reading from emonhub's log file and when it tried to send data to emoncms, it didn't get the expected response of "ok" therefore it is relaying the response it did get to help you resolve the issue.

The "Notice: Undefined index: userid in /var/www/emoncms/index.php on line 109" was what emoncms responded with, which is pinpointing the line number and file that failed due to an undefined userid (apikey)

As cryptic as it seems it does it's job as best it can. Had the apikey been an incorrect length or non-alphanumeric characters emonhub would of explained that as it can and does test for it, but it cannot know if the apikey is correct until emoncms confirms it's "ok" (or complains that it's not)

Glad you found the typo and got sorted, thanks for feedback as there is always room for improvement.

Paul

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.