Accesing envs

I have this config file:

console:
  max_message_size_bytes: 409600
logger:
  level: 'DEBUG'
runtime:
  js_entrypoint: 'build/index.js'
  js_read_only_globals: false
  envs:
    some_key: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'    
session:
  token_expiry_sec: 7200 # 2 hours
socket:
  max_message_size_bytes: 4096 # reserved buffer
  max_request_size_bytes: 131072
database:
  address:
    - nakama:nakama@localhost:5432/nakama

When I trie to access it from rpc by doing:

context.env['some_key'];

I am getting this error:

{"level":"error","ts":"2023-01-10T18:51:12.535Z","caller":"server/runtime_javascript_logger.go:94","msg":"invalid format argument: must be a string","rpc_id":"items_getitems"}

How should I read this envs?

Hello @matiasvillanueva, the issue seems to be how you’re setting your envs, not accesisng them. The key in your config file should be env and it should be a list of strings with the following format: key=value, you can see an example at Nakama: Configuration | Heroic Labs Documentation.

Hope this helps.