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

Access scopes response err "Not Found" #290

Closed
wcig opened this issue May 22, 2024 · 2 comments
Closed

Access scopes response err "Not Found" #290

wcig opened this issue May 22, 2024 · 2 comments

Comments

@wcig
Copy link

wcig commented May 22, 2024

Following is my code:

package api

import (
	"context"
	"encoding/json"
	"fmt"
	"log"
	"testing"

	goshopify "github.com/bold-commerce/go-shopify/v4"
)

func TestQuickStart(t *testing.T) {
	var (
		app     = goshopify.App{}
		shop    = "xxx.myshopify.com"
		token   = "xxx"
		version = "2024-04"
		ctx     = context.Background()
	)
	
	client, err := goshopify.NewClient(app, shop, token, goshopify.WithVersion(version))
	if err != nil {
		log.Fatal(err)
	}
	_ = client

	scopes, err := client.AccessScopes.List(ctx, nil)
	if err != nil {
		log.Fatal(err) // Not Found
	}
	fmt.Println(toJsonStr(scopes, true))
}

func toJsonStr(v interface{}, p bool) string {
	var (
		data []byte
		err  error
	)
	if p {
		data, err = json.MarshalIndent(v, "", "\t")
	} else {
		data, err = json.Marshal(v)
	}
	if err != nil {
		log.Fatal(err)
	}
	return string(data)
}

I have checked the problem is the request url:

So when request resource is AccessScope, the url does not need to spliced with the version.

@pnmcosta
Copy link

I can confirm this is an issue for me too, I'm looking to find out the existing scopes for a missing one we're introducing and getting 404.

I'm going to fork the repo and quickly test with the correct URL

pnmcosta added a commit to pnmcosta/go-shopify that referenced this issue May 23, 2024
pnmcosta added a commit to pnmcosta/go-shopify that referenced this issue May 23, 2024
@pnmcosta
Copy link

pnmcosta commented May 23, 2024

Done, PR #291 fixes it.

In the meantime feel free to use my fork, temporarily add:

replace github.com/bold-commerce/go-shopify/v4 => github.com/pnmcosta/go-shopify/v4 v4.0.0-20240523175202-128fc917c7f2

to the bottom of your project's go.mod file

pnmcosta added a commit to pnmcosta/go-shopify that referenced this issue May 23, 2024
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

2 participants