Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanity Check Failed Echo Framework #64

Open
putrafajarh opened this issue Dec 11, 2020 · 3 comments
Open

Sanity Check Failed Echo Framework #64

putrafajarh opened this issue Dec 11, 2020 · 3 comments

Comments

@putrafajarh
Copy link

im trying to integrate with Echo framework https://echo.labstack.com/

func main() {
	overseer.Run(overseer.Config{
		Program: server,
		Address: viper.GetString("server.address"),
		Fetcher: &fetcher.File{
			Path: "/home/putrafajarh/code/heimdall/heimdall",
		},
		Debug: true,
	})
}

func server(state overseer.State) {
	dbHost := viper.GetString(`database.host`)
	dbPort := viper.GetString(`database.port`)
	dbUser := viper.GetString(`database.user`)
	dbPass := viper.GetString(`database.pass`)
	dbName := viper.GetString(`database.name`)
	connection := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s", dbUser, dbPass, dbHost, dbPort, dbName)
	val := url.Values{}
	val.Add("parseTime", "1")
	val.Add("loc", "Asia/Jakarta")
	dsn := fmt.Sprintf("%s?%s", connection, val.Encode())
	dbConn, err := sql.Open(`mysql`, dsn)

	if err != nil {
		log.Fatal(err)
	}
	err = dbConn.Ping()
	if err != nil {
		log.Fatal(err)
	}

	defer func() {
		err := dbConn.Close()
		if err != nil {
			log.Fatal(err)
		}
	}()

	e := echo.New()
	e.Listener = state.Listener
	middL := _articleHttpDeliveryMiddleware.InitMiddleware()
	e.Use(middL.CORS)
	authorRepo := _authorRepo.NewMysqlAuthorRepository(dbConn)
	ar := _articleRepo.NewMysqlArticleRepository(dbConn)

	timeoutContext := time.Duration(viper.GetInt("context.timeout")) * time.Second
	au := _articleUcase.NewArticleUsecase(ar, authorRepo, timeoutContext)
	_articleHttpDelivery.NewArticleHandler(e, au)

	// s := &http.Server{
	// 	Addr: viper.GetString("server.address"),
	// }

	fmt.Printf("app#%s (%s) listening...\n", VersionID, state.ID)
	log.Fatal(e.Start(viper.GetString("server.address")))
	fmt.Printf("app#%s (%s) exiting...\n", VersionID, state.ID)
}

i got this log, and code changes doesnt work when i try to hit using postman

2020/12/11 07:32:32 [overseer master] proxy signal (urgent I/O condition)
2020/12/11 07:32:33 [overseer master] streaming update...
2020/12/11 07:32:33 [overseer master] proxy signal (urgent I/O condition)
2020/12/11 07:32:33 [overseer master] proxy signal (urgent I/O condition)
2020/12/11 07:32:33 [overseer master] proxy signal (urgent I/O condition)
2020/12/11 07:32:33 [overseer master] sanity check failed
2020/12/11 07:32:33 [overseer master] checking for updates...
2020/12/11 07:32:34 [overseer master] no updates
@nfoerster
Copy link

nfoerster commented Feb 8, 2021

I had the same issue but I solved it after debugging the token in and token out. The problem is, that the current code just expects from the new binary that the returned token is the only thing returned by the program. My program unfortunately used a deprecated function, which will be returned by go by default.

I edited the warning "sanity check failed" for the input and output token. As you can see the input token is bb49a04d65de655a, however, the output of the program is the warning + the correct token.

You can use my forked repo to test the token output:

go get github.com/nfoerster/overseer@a9d662d

2021/02/08 14:44:28 [overseer master] sanity check failed bb49a04d65de655a WARNING: Package "github.com/golang/protobuf/protoc-gen-go/generator" is deprecated.
        A future release of golang/protobuf will delete this package,
        which has long been excluded from the compatibility promise.

bb49a04d65de655a

After removing the warning, the program continues updating.

I think two points have to be fixed here:

  • Add output for input and output tokens
  • Think about a more intelligent way to parse the token from the response if its bigger than the token size of 8, e.g. take the last 8 bytes or implement a regex parsing

@yangyuan6
Copy link

See pull-request #72

@shuiYe-704265085
Copy link

I also encountered the same problem. Due to a relatively short time frame, I had to find another way to find a library that was relatively easy to use and just met my non pending process update needs. Please refer to:"https://www.mianshigee.com/project/inconshreveable-go-update/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants