0

I get the following error:

Keen.delete(:iron_worker_analytics, filters: [{:property_name => 'start_time', :operator => 'eq', :property_value => '0001-01-01T00:00:00Z'}])

Keen::ConfigurationError: Keen IO Exception: Project ID must be set

However, when I set the value, I get the following:

 warning: already initialized constant KEEN_PROJECT_ID
 iron.io/env.rb:36: warning: previous definition of KEEN_PROJECT_ID was here

Keen works fine when I run the app and load the values from a env.rb file but from the console I cannot get past this.

I am using the ruby gem.

Satchel
  • 16,414
  • 23
  • 106
  • 192

1 Answers1

0

I figured it out. The documentation is confusing. Per the documentation:

https://github.com/keenlabs/keen-gem

The recommended way to set keys is via the environment. The keys you can set are KEEN_PROJECT_ID, KEEN_WRITE_KEY, KEEN_READ_KEY and KEEN_MASTER_KEY. You only need to specify the keys that correspond to the API calls you'll be performing. If you're using foreman, add this to your .env file:

KEEN_PROJECT_ID=aaaaaaaaaaaaaaa KEEN_MASTER_KEY=xxxxxxxxxxxxxxx KEEN_WRITE_KEY=yyyyyyyyyyyyyyy KEEN_READ_KEY=zzzzzzzzzzzzzzz If not, make a script to export the variables into your shell or put it before the command you use to start your server.

But I had to set it explicitly as Keen.project_id after doing a Keen.methods.

It's sort of confusing since from the docs, I assumed I just need to set the variables. Maybe I am misunderstanding the docs but it was confusing at least to me.

Satchel
  • 16,414
  • 23
  • 106
  • 192