Getsentry/relay not accepting config file

Hello!

When trying to start relay container i get immediately after startup prompted with this error message:

error: invalid config value (field port)
  caused by: invalid digit found in string

my config.yml was directly copied from the on-premise repo version tag 20.7.2.

relay:
      upstream: "http://sentry-web:9000/"
      host: 0.0.0.0
      port: 3000
    logging:
      level: WARN
    processing:
      enabled: true
      kafka_config:
        - {name: "bootstrap.servers", value: "kafka:9092"}
        - {name: "message.max.bytes", value: 50000000} #50MB or bust
      redis: redis://redis:6379

Any idea why this error might be thrown?

I feel like you might have saved this file with some invisible control characters. Could you paste this through cat -v to see?

Also the indentation is messed up, logging should be at the same indent level as relay

Ah yes indentation was correct but copy and paste got the better of it. This is the file in its correct state i presume?

    relay:
      upstream: http://sentry-web:9000/
      host: 0.0.0.0
      port: 3000
    logging:
      level: WARN
    processing:
      enabled: true
      kafka_config:
        - {name: "bootstrap.servers", value: "cp-kafka:9092"}
        - {name: "message.max.bytes", value: 50000000} #50MB or bust
      redis: redis://redis:6379

output from cat -v:

    relay:
      upstream: http://sentry-web:9000/
      host: 0.0.0.0
      port: 3000
    logging:
      level: WARN
    processing:
      enabled: true
      kafka_config:
        - {name: "bootstrap.servers", value: "cp-kafka:9092"}
        - {name: "message.max.bytes", value: 50000000} #50MB or bust
      redis: redis://redis:6379

According to https://getsentry.github.io/relay/configuration/options/ wouldnt it be possible to omit port since it is the default value anyway? I tried that but it still gives the same error.

EDIT: Also VSCode dosent find any signs that shouldnt be in there.
EDIT2: Here is the version without port/host set:

I have no name!@relay-f7d7c5669-84mgz-debug:/work$ relay config show
error: invalid config value (field port)
  caused by: invalid digit found in string
I have no name!@relay-f7d7c5669-84mgz-debug:/work$ cat -v .relay/config.yml 
relay:
  upstream: "http://sentry-web:9000/"
logging:
  level: WARN
processing:
  enabled: true
  kafka_config:
    - {name: "bootstrap.servers", value: "cp-kafka:9092"}
    - {name: "message.max.bytes", value: 50000000} #50MB or bust
  redis: redis://redis:6379

Can you check your envvars and see if there’s any var called port in there? I think something in there may override the config.yml.

Was already in the process of writing a solution. Probably Kubernetes was auto setting the env variable RELAY_PORT to something like tcp://some.ip.adress:3000. I just overrode the env variable and it fixes this problem!

Another problem arose soon after how to tell sentry to recognize the internal relay and i cant find the options/feature flags i have to set to enable it. Proceeding with this manual id just input the information into this field but I dont even have the option to enable Relay in the list of settings…

1 Like

Yeah I vaguely remember this issue, just found it at https://github.com/getsentry/relay/issues/672

You should not have to set that up via the UI. Look at install.sh and what it does, you can configure internal relays entirely from sentry.conf.py

Ahh sadly its not possible to set 2 Solutions per thread! Thank you relay works now as intended (i hope :smiley: ) thank you so much for the help!