Skip to content

Commit

Permalink
fix(metabase): unable to login via username and password (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
StewartJingga authored Oct 28, 2021
1 parent fb2b2de commit 9e4ee62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions plugins/extractors/metabase/metabase.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,16 @@ func (e *Extractor) Init(ctx context.Context, configMap map[string]interface{})
if err != nil {
return plugins.InvalidConfigError{}
}

e.client = &http.Client{
Timeout: 4 * time.Second,
Timeout: 30 * time.Second,
}

// get session id for further api calls in metabase
if e.sessionID, err = e.getSessionID(); err != nil {
sessionID, err := e.getSessionID()
if err != nil {
return errors.Wrap(err, "failed to fetch session ID")
}
e.sessionID = sessionID

return nil
}
Expand Down Expand Up @@ -224,6 +225,7 @@ func (e *Extractor) getSessionID() (sessionID string, err error) {
if err != nil {
return
}

return data.ID, nil
}

Expand All @@ -239,7 +241,7 @@ func (e *Extractor) makeRequest(method, url string, payload interface{}, data in
return errors.Wrap(err, "failed to create request")
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Metabase-Session", e.config.SessionID)
req.Header.Set("X-Metabase-Session", e.sessionID)

res, err := e.client.Do(req)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion plugins/extractors/metabase/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package metabase
import "time"

const (
timestampFormat = "2006-01-02T15:04:05.999999"
timestampFormat = "2006-01-02T15:04:05.999999Z"
)

type Dashboard struct {
Expand Down

0 comments on commit 9e4ee62

Please sign in to comment.