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

unable to find source related to: "github.com/auth0-community/go-auth0" #300

Open
bussiere opened this issue Jul 27, 2019 · 3 comments
Open
Labels
area/core bug Something isn't working

Comments

@bussiere
Copy link

The following program sample.go triggers a panic:

It seems to have a problem with thos package when i try to run a program with this pckage.

regards

@ldez ldez added the question Further information is requested label Jul 27, 2019
@ldez
Copy link
Contributor

ldez commented Jul 27, 2019

Could you provide more information: how you produce the error exactly? What's your OS? lib or command-line?
Could you provide a sample with a reproducible case?

Thanks.

@bussiere
Copy link
Author

bussiere commented Jul 28, 2019

package main

import (
	"fmt"
	"github.com/auth0-community/go-auth0"
	"github.com/gin-gonic/gin"
	jose "gopkg.in/square/go-jose.v2"
	"log"
	"net/http"
	"github.com/gin-contrib/cors"
	"time"
)
var (
	audience string
	domain   string
)

type  Response struct{
	Status string

}
func test(c *gin.Context){
	var response Response
	response.Status = "Ok"
	c.JSON(http.StatusOK,response)

}
func setAuth0Variables() {
	audience = "tsure--api"
	domain = "t-trove.eu.auth0.com"
}


func authRequired() gin.HandlerFunc {
	return func(c *gin.Context) {

		var auth0Domain = "https://" + domain + "/"
		jwkClient := auth0.NewJWKClient(auth0.JWKClientOptions{URI: fmt.Sprintf("%s.well-known/jwks.json", auth0Domain)}, nil)
		validator := auth0.NewValidator(auth0.NewConfiguration(jwkClient, []string{}, auth0Domain, jose.RS256), nil)
		_, err := validator.ValidateRequest(c.Request)

		if err != nil {
			log.Println(err)
			terminateWithError(http.StatusUnauthorized, "token is not valid", c)
			return
		}
		c.Next()
	}
}

func terminateWithError(statusCode int, message string, c *gin.Context) {
	c.JSON(statusCode, gin.H{"error": message})
	c.Abort()
}

func main() {
	setAuth0Variables()

	r := gin.Default()
	//r.Use(cors.Default())
	r.Use(cors.New(cors.Config{
		AllowOrigins:     []string{"*"},
		AllowMethods:     []string{"PUT", "PATCH","POST","OPTIONS"},
		AllowHeaders:     []string{"Origin,Authorization,Token"},
		ExposeHeaders:    []string{"Content-Length"},
		AllowCredentials: true,
		AllowOriginFunc: func(origin string) bool {
			return origin == "*"
		},
		MaxAge: 12 * time.Hour,
	}))
	authorized := r.Group("/")
	authorized.Use(authRequired())
	authorized.POST("test/", test)
	authorized.GET("test/", test)
	authorized.OPTIONS("test/", test)
	r.Run((":8200")) // listen and serve on 0.0.0.0:8080
}

@mpl
Copy link
Collaborator

mpl commented Aug 26, 2020

Simpler repro:

package main

import (
	"github.com/auth0-community/go-auth0"
)


func main() {
	println(auth0.ErrInvalidContentType.Error())
}

Which seems to show that the original issue is fixed, but that we now have a different problem:

% yaegi run ./sample.go 
runtime error: invalid memory address or nil pointer dereference
goroutine 1 [running]:
runtime/debug.Stack(0x1, 0xc0001a4800, 0x40)
	/Users/mpl/go1/src/runtime/debug/stack.go:24 +0x9d
github.com/containous/yaegi/interp.(*Interpreter).eval.func1(0xc000451cb0)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:362 +0xbc
panic(0x19796a0, 0x222d5a0)
	/Users/mpl/go1/src/runtime/panic.go:967 +0x15d
github.com/containous/yaegi/interp._append(0xc00001d300)
	/Users/mpl/src/github.com/containous/yaegi/interp/run.go:2469 +0x456
github.com/containous/yaegi/interp.setExec.func1(0xc00001d300)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2350 +0xb2
github.com/containous/yaegi/interp.setExec.func1(0xc00001d500)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001dd00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001df00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001d900)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001d600)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001cb00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001cc00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001c300)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001c500)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001c700)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001bd00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001bf00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001c000)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001a800)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001ab00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001b700)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001b800)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001b900)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001b400)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001b100)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001ac00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001ad00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000019300)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001a300)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001a400)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001a500)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000019400)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000019500)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc00001a000)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000019d00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000019600)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000019700)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000019800)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000018600)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000018700)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000018e00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000018f00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000018d00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000018800)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000018900)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc0001fff00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc000018100)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc0001ffa00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc0001ffc00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc0001ff500)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc0001ff700)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc0001fed00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc0001fef00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc0001ff100)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc0001fe200)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc0001fe800)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc0001fe900)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc0001fea00)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc0001fe300)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec.func1(0xc0001fe500)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2339 +0x25d
github.com/containous/yaegi/interp.setExec(0xc0001fe500)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:2353 +0xf5
github.com/containous/yaegi/interp.genRun.func1(0xc0001fc400, 0xc00044ef01)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:1906 +0x87
github.com/containous/yaegi/interp.(*node).Walk(0xc0001fc400, 0xc00044efd0, 0x0)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:197 +0xc9
github.com/containous/yaegi/interp.(*node).Walk(0xc0001fc100, 0xc00044efd0, 0x0)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:201 +0x70
github.com/containous/yaegi/interp.(*node).Walk(0xc0001f5400, 0xc00044efd0, 0x0)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:201 +0x70
github.com/containous/yaegi/interp.genRun(0xc0001f5400, 0xc0001d7700, 0x0)
	/Users/mpl/src/github.com/containous/yaegi/interp/cfg.go:1898 +0x60
github.com/containous/yaegi/interp.(*Interpreter).importSrc(0xc00022a1a0, 0xc00020aec0, 0x1a, 0xc0002115f1, 0x21, 0xc000428a00, 0x7, 0x0, 0x0)
	/Users/mpl/src/github.com/containous/yaegi/interp/src.go:141 +0x913
github.com/containous/yaegi/interp.(*Interpreter).gta.func1(0xc000439800, 0xc00044fdd0)
	/Users/mpl/src/github.com/containous/yaegi/interp/gta.go:242 +0x133f
github.com/containous/yaegi/interp.(*node).Walk(0xc000439800, 0xc00044fdd0, 0x0)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:197 +0xc9
github.com/containous/yaegi/interp.(*node).Walk(0xc000438100, 0xc00044fdd0, 0x0)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:201 +0x70
github.com/containous/yaegi/interp.(*node).Walk(0xc0003e5f00, 0xc00044fdd0, 0x0)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:201 +0x70
github.com/containous/yaegi/interp.(*Interpreter).gta(0xc00022a1a0, 0xc0003e5f00, 0xc00020aec0, 0x1a, 0xc00020a201, 0x1a, 0x0, 0x1, 0xc0003e5f00, 0x0, ...)
	/Users/mpl/src/github.com/containous/yaegi/interp/gta.go:20 +0x1e8
github.com/containous/yaegi/interp.(*Interpreter).importSrc(0xc00022a1a0, 0x0, 0x0, 0xc00020a201, 0x1a, 0xc0003b6500, 0xc0003e3c00, 0xc00022a1a0, 0x1c55b60)
	/Users/mpl/src/github.com/containous/yaegi/interp/src.go:105 +0xee1
github.com/containous/yaegi/interp.(*Interpreter).gta.func1(0xc0003ba000, 0xc000190c18)
	/Users/mpl/src/github.com/containous/yaegi/interp/gta.go:242 +0x133f
github.com/containous/yaegi/interp.(*node).Walk(0xc0003ba000, 0xc000450c18, 0x0)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:197 +0xc9
github.com/containous/yaegi/interp.(*node).Walk(0xc00036b900, 0xc000450c18, 0x0)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:201 +0x70
github.com/containous/yaegi/interp.(*node).Walk(0xc00036b700, 0xc000450c18, 0x0)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:201 +0x70
github.com/containous/yaegi/interp.(*Interpreter).gta(0xc00022a1a0, 0xc00036b700, 0xc000211260, 0x23, 0xc000210fc1, 0x23, 0x0, 0x1, 0xc00036b700, 0x0, ...)
	/Users/mpl/src/github.com/containous/yaegi/interp/gta.go:20 +0x1e8
github.com/containous/yaegi/interp.(*Interpreter).importSrc(0xc00022a1a0, 0x0, 0x0, 0xc000210fc1, 0x23, 0x1c5a700, 0x1c5a1e0, 0xc000191150, 0x118ad1e)
	/Users/mpl/src/github.com/containous/yaegi/interp/src.go:105 +0xee1
github.com/containous/yaegi/interp.(*Interpreter).gta.func1(0xc00036a300, 0xc0002003e8)
	/Users/mpl/src/github.com/containous/yaegi/interp/gta.go:242 +0x133f
github.com/containous/yaegi/interp.(*node).Walk(0xc00036a300, 0xc000451a60, 0x0)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:197 +0xc9
github.com/containous/yaegi/interp.(*node).Walk(0xc00036a200, 0xc000451a60, 0x0)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:201 +0x70
github.com/containous/yaegi/interp.(*node).Walk(0xc00036a000, 0xc000451a60, 0x0)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:201 +0x70
github.com/containous/yaegi/interp.(*Interpreter).gta(0xc00022a1a0, 0xc00036a000, 0xc00035bae0, 0x4, 0xc00035bae0, 0x4, 0x0, 0xc000214180, 0x0, 0x0, ...)
	/Users/mpl/src/github.com/containous/yaegi/interp/gta.go:20 +0x1e8
github.com/containous/yaegi/interp.(*Interpreter).gtaRetry(0xc00022a1a0, 0xc000451c20, 0x1, 0x1, 0xc00035bae0, 0x4, 0xc00035bae0, 0x4)
	/Users/mpl/src/github.com/containous/yaegi/interp/gta.go:325 +0x13a
github.com/containous/yaegi/interp.(*Interpreter).eval(0xc00022a1a0, 0xc0002d3300, 0x80, 0x7ffeefbff63a, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:384 +0x28f
github.com/containous/yaegi/interp.(*Interpreter).EvalPath(0xc00022a1a0, 0x7ffeefbff63a, 0xb, 0x200, 0xc0002d3280, 0x80, 0x0, 0x7ffeefbff63c)
	/Users/mpl/src/github.com/containous/yaegi/interp/interp.go:346 +0xdf
main.runFile(0xc00022a1a0, 0x7ffeefbff63a, 0xb, 0xc000200240, 0x1)
	/Users/mpl/src/github.com/containous/yaegi/cmd/yaegi/run.go:122 +0x1cc
main.run(0xc0000a21a0, 0x1, 0x1, 0x1aa1380, 0x1944380)
	/Users/mpl/src/github.com/containous/yaegi/cmd/yaegi/run.go:80 +0x7a9
main.main()
	/Users/mpl/src/github.com/containous/yaegi/cmd/yaegi/yaegi.go:119 +0x2f4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants