Upload chef cookbook to the Public Supermarket

I'm trying to upload a cookbook to the Supermarket but facing authentication issue. I tried resetting the validation key of the created Organisation and also regenerated the User key, but it did not work.

Below is the error message:

# knife supermarket share starter -VV
INFO: Using configuration from /root/chef-repo/.chef/config.rb
INFO: Validating ruby files
INFO: Validating templates
INFO: Syntax OK
Generating metadata for starter from /tmp/chef-starter-build20231025-11775-6q4gys/starter/metadata.rb
Making tarball starter.tgz
DEBUG: Signing: method: post, url: https://supermarket.chef.io/api/v1/cookbooks, file: #<File:0x0000000002fa4b58>, User-id: abcd, Timestamp: 2023-10-25T13:13:39Z
ERROR: Authentication failed due to an invalid public/private key pair. If you have changed your keys recently try logging out and logging back in to Supermarket.

I also tried revoking the access at Chef Identity Service on Authorized Applications page to check, but this doesn't reopen the same grant access to Applications.

Could someone help me out with these two issues?

are you trying to publish to an internal supermarket or the public community supermarket?

Public supermarket requires a user and org at Sign In - Chef Manage that user needs to have a password and pem key. If users exists then they need to login to supermarket.chef.io which will redirect to manage.chef.io. Once authenticated the users auth info will be stored in supermarket and can share cookbook with their pem key credentials.

I'm uploading to the public community supermarket. I followed this doc Share Cookbooks on the Chef Supermarket to create the user and org.
I'm now able to see the chef supermarket at the Authorized Applications page. Let me try uploading the cookbook.
Is there a way to check the connection to the Chef supermarket from the terminal?
As a new user of Chef applications, I would like to know what is expected under the /root/chef-repo/.chef folder. I have installed chef server and workstation and below are the version details:
Chef server:

# chef-server-ctl version
15.8.0

Chef workstation:

# chef -v
Chef Workstation version: 23.7.1042
Chef Habitat version: 1.6.652
Test Kitchen version: 3.5.0
Cookstyle version: 7.32.2
Chef Infra Client version: 18.2.7
Chef InSpec version: 5.22.3
Chef CLI version: 5.6.12

@Stromweld I still get the above error while uploading the cookbook.
Could someone please help me here?

You don't need local chef-sever as community supermarket only works with hosted chef-infra. That doc is missing the part of signing in at-least once to the public supermarket before trying to upload the cookbook.

For the .chef folder it should contain the starter kit files, <user_name>.pem, knife.rb or config.rb file with settings found in that doc. Make sure you are in a sub directory of the parent containing the .chef folder when running the knife command. Other wise move .chef to the users home folder. Then after you have logged in to the community supermarket knife supermarket share command should work. Unfortunately there isn't a command I'm aware of to verify the supermarket connection.

As my cookbook as dependency on another cookbook - alphard-python, if I try to run the cookbook locally using chef-apply it fails with the below error.

# chef-apply recipes/default.rb 
[2023-10-30T14:31:19+05:30] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2023-10-30T14:31:19+05:30] FATAL: ---------------------------------------------------------------------------------------
[2023-10-30T14:31:19+05:30] FATAL: PLEASE PROVIDE THE CONTENTS OF THE stacktrace.out FILE (above) IF YOU FILE A BUG REPORT
[2023-10-30T14:31:19+05:30] FATAL: ---------------------------------------------------------------------------------------
[2023-10-30T14:31:19+05:30] FATAL: NoMethodError: undefined method `unreachable_cookbook?' for nil:NilClass
# cat /var/chef/cache/chef-stacktrace.out
NoMethodError: undefined method `unreachable_cookbook?' for nil:NilClass
/opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-18.2.7/lib/chef/run_context.rb:605:in `unreachable_cookbook?'
/opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-18.2.7/lib/chef/run_context.rb:412:in `load_recipe'
/opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-18.2.7/lib/chef/run_context.rb:385:in `block in include_recipe'
/opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-18.2.7/lib/chef/run_context.rb:384:in `each'
/opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-18.2.7/lib/chef/run_context.rb:384:in `include_recipe'
/opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-18.2.7/lib/chef/dsl/include_recipe.rb:26:in `include_recipe'
recipes/default.rb:5:in `run_chef_recipe'
/opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-18.2.7/lib/chef/application/apply.rb:217:in `instance_eval'
/opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-18.2.7/lib/chef/application/apply.rb:217:in `run_chef_recipe'
/opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-18.2.7/lib/chef/application/apply.rb:232:in `run_application'
/opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-18.2.7/lib/chef/application/apply.rb:245:in `run'
/opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/chef-bin-18.2.7/bin/chef-apply:24:in `<top (required)>'
/usr/bin/chef-apply:426:in `load'
/usr/bin/chef-apply:426:in `<main>'

While I try to download the dependency cookbook from supermarket to my local chef workstation, it doesn't download the cookbook, probably looking for it in the hosted server under the created org. Please let me know what am I missing. How do I resolve this error?

# knife download cookbook alphard-python 1.0.0 -VVV
INFO: Using configuration from /root/chef-repo/.chef/config.rb
TRACE: Chef::HTTP calling Chef::HTTP::JSONInput#handle_request
TRACE: Chef::HTTP calling Chef::HTTP::JSONOutput#handle_request
TRACE: Chef::HTTP calling Chef::HTTP::CookieManager#handle_request
TRACE: Chef::HTTP calling Chef::HTTP::Decompressor#handle_request
TRACE: Chef::HTTP calling Chef::HTTP::Authenticator#handle_request
TRACE: Signing the request as vinothini123
TRACE: Chef::HTTP calling Chef::HTTP::RemoteRequestID#handle_request
TRACE: Chef::HTTP calling Chef::HTTP::APIVersions#handle_request
TRACE: Chef::HTTP calling Chef::HTTP::ValidateContentLength#handle_request
TRACE: Initiating GET to https://api.chef.io/organizations/example-org/cookbooks
TRACE: ---- HTTP Request Header Data: ----
TRACE: Accept: application/json
TRACE: Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
TRACE: X-Ops-Server-API-Version: 0
TRACE: X-OPS-SIGN: algorithm=sha1;version=1.1;
TRACE: X-OPS-USERID: vinothini123
TRACE: X-OPS-TIMESTAMP: 2023-10-30T09:26:38Z
TRACE: X-OPS-CONTENT-HASH: 2jmj7l5rSw0yVb/vlWAYkK/YBwk=
TRACE: X-OPS-AUTHORIZATION-1: I8ThE6C3NabENVuNMLT5NAYw6a+qZbY1FbYSkSvMuc9/i9H5ZCUbAwX77ivP
TRACE: X-OPS-AUTHORIZATION-2: HbZquQJ6YYxLkrR037YqNJsB/ut0/3/0PnhjfEYBa7mlSvWW74l5Gpoh7m3g
TRACE: X-OPS-AUTHORIZATION-3: tljNSWZSkJ4MKnkyTpIjP+JpjRCDaskQQwLMy84ji+Pqg3VnyOG99Va9r3J7
TRACE: X-OPS-AUTHORIZATION-4: jPmICnlvTxtdkr0NfgOCLyhyKTj1SOjI0WEJuCkH8OMVQCpydMEJCcY0Lk0k
TRACE: X-OPS-AUTHORIZATION-5: zh0AqnJAlvdAbm7QPkin1TGtoApjQr82YUrJ11BXysPXH+QMDTmHvOP28XFb
TRACE: X-OPS-AUTHORIZATION-6: UF+Ur74kZRuOYOXDlGRwpoY1p6/stHZnOcmYxhX29g==
TRACE: HOST: api.chef.io:443
TRACE: X-REMOTE-REQUEST-ID: c0b9fb89-3f63-473c-b64f-210db7946617
TRACE: ---- End HTTP Request Header Data ----
TRACE: ---- HTTP Status and Header Data: ----
TRACE: HTTP 1.1 200 OK
TRACE: cache-control: no-store
TRACE: content-type: application/json
TRACE: date: Mon, 30 Oct 2023 09:26:38 GMT
TRACE: pragma: no-cache
TRACE: x-ops-server-api-version: {"min_version":"0","max_version":"2","request_version":"0","response_version":"0"}
TRACE: content-length: 2
TRACE: connection: Close
TRACE: ---- End HTTP Status/Header Data ----
TRACE: Chef::HTTP calling Chef::HTTP::ValidateContentLength#handle_response
TRACE: Content-Length validated correctly.
TRACE: Chef::HTTP calling Chef::HTTP::APIVersions#handle_response
TRACE: Chef::HTTP calling Chef::HTTP::RemoteRequestID#handle_response
TRACE: Chef::HTTP calling Chef::HTTP::Authenticator#handle_response
TRACE: Chef::HTTP calling Chef::HTTP::Decompressor#handle_response
TRACE: Chef::HTTP calling Chef::HTTP::CookieManager#handle_response
TRACE: Chef::HTTP calling Chef::HTTP::JSONOutput#handle_response
TRACE: Chef::HTTP calling Chef::HTTP::JSONInput#handle_response