NTUDevSoc / eventathon

DevSoc events planner, calendar and attendance tool
GNU General Public License v3.0
3 stars 1 forks source link

API's causing errors in the console #28

Closed EvelynVoce closed 2 years ago

EvelynVoce commented 2 years ago

APIs work fine at face value however I've noticed an error in the console whenever an API call is made suggesting that 'element' (see events-endpoint.js line 15) is null. Most likely because it is null until initially until it gets a response, just wondered if this could be fixed.

jordanofoster commented 2 years ago

If you don't mind, I'd want to have a look at this if possible - I've mostly been doing backend stuff so far and considering that I lack access to DevSoc's Google account - and therefore can't setup OAuth2 stuff - it'd be nice to get some JS/React experience.

jordanofoster commented 2 years ago

I've taken a look, and I think this is the issue we're facing?

Upgrade failed due to an unexpected exception:
System.ArgumentException: Host can't be null
   at Npgsql.NpgsqlConnectionStringBuilder.Validate()
   at Npgsql.NpgsqlConnection.GetPoolAndSettings()
   at Npgsql.NpgsqlConnection.set_ConnectionString(String value)
   at Npgsql.NpgsqlConnection..ctor(String connectionString)
   at DbUp.Postgresql.PostgresqlConnectionManager.<>c__DisplayClass0_0.<.ctor>b__0(IUpgradeLog l)
   at DbUp.Engine.Transactions.DelegateConnectionFactory.<>c__DisplayClass1_0.<.ctor>b__0(IUpgradeLog l, DatabaseConnectionManager _)
   at DbUp.Engine.Transactions.DelegateConnectionFactory.CreateConnection(IUpgradeLog upgradeLog, DatabaseConnectionManager databaseConnectionManager)
   at DbUp.Engine.Transactions.DatabaseConnectionManager.CreateConnection(IUpgradeLog upgradeLog)
   at DbUp.Engine.Transactions.DatabaseConnectionManager.OperationStarting(IUpgradeLog upgradeLog, List`1 executedScripts)
   at DbUp.Engine.UpgradeEngine.PerformUpgrade()
Failed to migrate database: Host can't be null
Database successfully migrated
LukeBillo commented 2 years ago

This is because the connection string in appsettings.json is, by default, an empty string:

  "ConnectionStrings": {
    "Eventathon": ""    
  },

We could set up a docker compose to spin up a local PostgreSQL server as an alternative (with a pre-defined admin login)?

jordanofoster commented 2 years ago

We could set up a docker compose to spin up a local PostgreSQL server as an alternative (with a pre-defined admin login)?

I say we consider it, and keep this issue open for now until then - since it's not actually affecting functionality itself. But since this is an issue that arose from touching the DOM directly in React (as discussed in the #eventathon discord channel), hopefully it won't be a problem during dev so long as we check for this in the future.

That said, at some point we will probably need to set this up when actually deploying it, but that's a long way off from where we're currently at.

LukeBillo commented 2 years ago

Going to close this as done, as we've now got a docker-compose.yml for a local postgresql server (see appsettings.Development.json)