diff --git a/api/datastore/postgres/postgres.go b/api/datastore/postgres/postgres.go index 6577b2635..5f3ac0fb8 100644 --- a/api/datastore/postgres/postgres.go +++ b/api/datastore/postgres/postgres.go @@ -8,12 +8,12 @@ import ( "context" + "bytes" "github.com/Sirupsen/logrus" + "github.com/iron-io/functions/api/datastore/internal/datastoreutil" "github.com/iron-io/functions/api/models" "github.com/lib/pq" _ "github.com/lib/pq" - "bytes" - "github.com/iron-io/functions/api/datastore/internal/datastoreutil" ) const routesTableCreate = ` @@ -185,8 +185,8 @@ func (ds *PostgresDatastore) GetApp(ctx context.Context, name string) (*models.A Name: resName, } - if err := json.Unmarshal([]byte(config), &res.Config); err != nil { - return nil, err + if len(config) > 0 { + json.Unmarshal([]byte(config), &res.Config) } return res, nil @@ -295,7 +295,6 @@ func (ds *PostgresDatastore) InsertRoute(ctx context.Context, route *models.Rout return err }) - if err != nil { return nil, err } @@ -563,7 +562,6 @@ func (ds *PostgresDatastore) Get(ctx context.Context, key []byte) ([]byte, error return []byte(value), nil } - func (ds *PostgresDatastore) Tx(f func(*sql.Tx) error) error { tx, err := ds.db.Begin() if err != nil {