pinax-network / substreams-sink-clickhouse

Substreams ClickHouse Sink
MIT License
3 stars 0 forks source link

throw error on init #80

Closed DenisCarriere closed 11 months ago

DenisCarriere commented 12 months ago

Assuming this is because AUTH_KEY is not being provided, it throws an error?

image

.env

PUBLIC_KEY=${{shared.PUBLIC_KEY}}
VERBOSE=${{shared.VERBOSE}}
HOST=${{shared.HOST}}
DATABASE=default
USERNAME=default
PASSWORD=<PASSWORD>

Another logging error =>

2023-11-17 00:59:37.580 ERROR substreams-sink-clickhouse The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch()

DenisCarriere commented 12 months ago

Oh.. the issue was because the HOST url was using http:// instead of https://

🤷 perhaps there's a way we can improve error messages on /init

instead of doing a catch all

export default async function () {
  try {
    await ping();
    await createDatabase(config.database);
    await initializeDefaultTables();
    return toText("OK");
  } catch (e: any) {
    logger.error(e.message);
    return BadRequest;
  }
}
JulienR1 commented 12 months ago

I have replaced the try-catch block with controlled response objects. The logs are much better and separated for each step.

DenisCarriere commented 12 months ago

Perfect 👌

JulienR1 commented 11 months ago

Closed by #85