launchdarkly / ld-find-code-refs

Build tool for automatically sending feature flag code references to LaunchDarkly
https://launchdarkly.com
Other
47 stars 34 forks source link

error creating repository: bad request #134

Closed huydinhle closed 4 years ago

huydinhle commented 4 years ago
ld-find-code-refs --accessToken=api-XXXX --projKey=dev -repoName=repo --dir="/path/repo" --debug
DEBUG: 2020/07/24 13:56:55 coderefs.go:28: starting ld-find-code-refs with options:
 {AccessToken:************************************2571 BaseUri:https://app.launchdarkly.com Branch: CommitUrlTemplate: DefaultBranch:master Dir:/Users/huyle/src/bitbucket.org/picktrace/web-client HunkUrlTemplate: OutDir: ProjKey:dev RepoName:epoName=web-client RepoType:custom RepoUrl: ContextLines:2 UpdateSequenceId:-1 Debug:true DryRun:false IgnoreServiceErrors:false Aliases:[{Type:camelcase Name: Flags:map[] Paths:[] Patterns:[] Command:<nil> Timeout:<nil>} {Type:pascalcase Name: Flags:map[] Paths:[] Patterns:[] Command:<nil> Timeout:<nil>}] Delimiters:{DisableDefaults:false Additional:[]}}
INFO: 2020/07/24 13:56:55 coderefs.go:36: absolute directory path: /Users/huyle/src/bitbucket.org/picktrace/web-client
DEBUG: 2020/07/24 13:56:55 git.go:61: identified branch name: master
INFO: 2020/07/24 13:56:55 git.go:41: git branch: master
DEBUG: 2020/07/24 13:56:55 git.go:76: identified head sha: c8aa9810f304c22c529763767a05c9b46892f89a
DEBUG: 2020/07/24 13:56:55 client.go:344: [DEBUG] GET https://app.launchdarkly.com/api/v2/code-refs/repositories/epoName=web-client
DEBUG: 2020/07/24 13:56:55 client.go:344: [DEBUG] POST https://app.launchdarkly.com/api/v2/code-refs/repositories
ERROR: 2020/07/24 13:56:55 coderefs.go:243: error creating repository: bad request
 Add the --ignoreServiceErrors flag to ignore this error

What have I done wrong here?

ld-kyee commented 4 years ago

Hi, It looks like you're missing a - in front of repoName option. There should be two dashes so --repoName=repo. Can you try that and let me know if that fixes your issue?

huydinhle commented 4 years ago

ahh thank you for that. What is the projectKey should I put in here. I tried all the fields likeskd-key mobile-key , clientside-id or even project-name, and none of this work. I kept getting error

could not retrieve flag keys from LaunchDarkly: Status: 404 Not Found, Body: {"message":"Unknown project key Dev"}
ld-kyee commented 4 years ago

Hey @huydinhle,

It's the project key for your Launch Darkly Project. I think you might be looking at the environment section. So

Screen Shot 2020-07-24 at 4 23 14 PM

Does this work for you?

huydinhle commented 4 years ago

it works thank you