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

cant connect store to hydrogen #2419

Open
tassawarr opened this issue Aug 9, 2024 · 16 comments
Open

cant connect store to hydrogen #2419

tassawarr opened this issue Aug 9, 2024 · 16 comments

Comments

@tassawarr
Copy link

What is the location of your example repository?

No response

Which package or tool is having this issue?

CLI

What version of that package or tool are you using?

CMD

What version of Remix are you using?

No response

Steps to Reproduce

following this documentation im stuck on store connection.

https://shopify.dev/docs/storefronts/headless/hydrogen/getting-started#step-1-create-a-new-hydrogen-storefront

Expected Behavior

it must connect the shopify store to my local hydrogen storefront: the authentication issues comes up.

Actual Behavior

this is what im experiencing right now while connecting to store. i tried finding CLI > SHOPIFY CLI but couldnt find it.

Screenshot 2024-08-09 184007

@michenly
Copy link
Contributor

michenly commented Aug 9, 2024

I am unable to re-produce this on my end, and this looks to be permission related and its impossible for me to verify.

@graygilmore do you know what settings is missing that might trigger this response?

Pass that I would suggest that you contact your Shopify customer service who have access to your account to check for the proper permission.

@tassawarr
Copy link
Author

tassawarr commented Aug 9, 2024

thanks @michenly for your reply, i've tried every single permission inside headless app > storefront api settings. but the error stands.
guide me how to use CLI. as im using Windows CMD and macOS terminal. which one should i use?

that image says.

 The Admin GraphQL API responded unsuccessfully with errors:                 
                                                                              
  [                                                                           
    {                                                                         
      "message": "Access denied for hydrogenStorefronts field. Required       
  access: Request must be initiated from the Shopify CLI and user must have   
  full access to apps or access to the Hydrogen channel.",                    
      "locations": [                                                          
        {                                                                     
          "line": 3,                                                          
          "column": 5                                                         
        }                                                                     
      ],                                                                      
      "path": [                                                               
        "hydrogenStorefronts"                                                 
      ],                                                                      
      "extensions": {                                                         
        "code": "ACCESS_DENIED",                                              
        "documentation": "https://shopify.dev/api/usage/access-scopes",       
        "requiredAccess": "Request must be initiated from the Shopify CLI     
  and user must have full access to apps or access to the Hydrogen channel."  
      }                                                                       
    }                                                                         
  ]                                                                           
                                                                              
  Request ID: b8468db5-e0b6-4f3c-9bb9-975bd1c09e2a-1723221772                 
                                                                              
                                                                              
  To investigate the issue, examine this stack trace:                         
    at makeRequest (Users/horizon/AppData/Roaming/npm/node_modules/@shopify/  
    cli/dist/chunk-UBCH575K.js:50408)                                         
    at processTicksAndRejections (node:internal/process/task_queues:95)       
    at async debugLogResponseInfo (Users/horizon/AppData/Roaming/npm/node_mo  
    dules/@shopify/cli/dist/chunk-UBCH575K.js:50444)                          
    at (Users/horizon/AppData/Roaming/npm/node_modules/@shopify/cli/dist/chu  
    nk-U2PN6QZ2.js:4671)                                                      
    at (Users/horizon/AppData/Roaming/npm/node_modules/@shopify/cli/dist/chu  
    nk-T4Y7NDNJ.js:42849)                                                     
    at async adminRequest (Users/horizon/AppData/Roaming/npm/node_modules/@s  
    hopify/cli/dist/chunk-K7KD247K.js:156914)                                 
    at async getStorefronts (Users/horizon/AppData/Roaming/npm/node_modules/  
    @shopify/cli/dist/chunk-K7KD247K.js:156973)                               
    at async linkStorefront (Users/horizon/AppData/Roaming/npm/node_modules/  
    @shopify/cli/dist/chunk-K7KD247K.js:163050)                               
    at async runLink (Users/horizon/AppData/Roaming/npm/node_modules/@shopif  
    y/cli/dist/chunk-K7KD247K.js:163014)                                      
    at run (Users/horizon/AppData/Roaming/npm/node_modules/@shopify/cli/dist  
    /chunk-K7KD247K.js:163002) 

@tassawarr
Copy link
Author

also, when i setup the custom storefront it doesnt gave me the .env file include store token or store url as it seems to be including on first setup

@graygilmore
Copy link
Contributor

It sounds like your particular account does not have access to Apps or the Hydrogen sales channel. It's not about the access that the channel has, it's about the access that you have to the channel. The link that the error message is providing is misleading.

If you can confirm that the account you're logging in with has access to apps (you can test this by logging in with that account and navigating to the Hydrogen sales channel in the admin) we can dig into the logs to see what's up.

@dd-anish
Copy link

I have some questions for this, the same error was faced by us ( me and @KedarMalapDev ), but after some research we did found the solution for this. But before telling you the solution, let me know the answers for the questions:

  1. Do your store has Hydrogen Sales Channel Access (I believe it is not available for Free Plans)
  2. Since, you mentioned you have Headless Channel then the command npx shopify hydrogen env pull will give you the error you are facing now. So do your project structure has env credentials? If yes then are they defined?

@HeisUser
Copy link

HeisUser commented Sep 9, 2024

I have this kind of same Error on Linking Mock.shop by "npx shopify hydrogen link" or "h2 link"
My GitHub is https://github.com/HeisUser/store-hydrogen-remix-js.git

I was according this Official Guide https://shopify.dev/docs/storefronts/headless/hydrogen/getting-started to linking my Headless Storefront to Mock.shop of Hydrogen. Which is the Step 3 as https://shopify.dev/docs/storefronts/headless/hydrogen/getting-started#step-3-link-your-hydrogen-project-to-shopify and get error by npx shopify hydrogen link command.
Step 3 means simply run npx shopify hydrogen link command to automatically linking and create .env file and the APIs values of .env will be automatically added.
But I still get Error Screenshot as
Image

$ npm list screenshot as
Image

$ npm list -g screenshot as
Image

@graygilmore
Copy link
Contributor

I have this kind of same Error on Linking Mock.shop by "npx shopify hydrogen link" or "h2 link"

@HeisUser what are you trying to do? Have you already created a Hydrogen storefront in your Shopify admin?

@HeisUser
Copy link

HeisUser commented Sep 9, 2024

I have this kind of same Error on Linking Mock.shop by "npx shopify hydrogen link" or "h2 link"

@HeisUser what are you trying to do? Have you already created a Hydrogen storefront in your Shopify admin?

Please read my first comment again, because I'd edited it.
Where is the Hydrogen Storefront?
Please see red and orange arrows on my screenshot as
Image

@graygilmore
Copy link
Contributor

@HeisUser the Hydrogen CLI commands only relate to storefronts in the Hydrogen channel, not the Headless channel. Make sure the user you are authenticating over the CLI with is the same user that has access to the Hydrogen channel in the admin.

@HeisUser
Copy link

HeisUser commented Sep 9, 2024

@HeisUser the Hydrogen CLI commands only relate to storefronts in the Hydrogen channel, not the Headless channel. Make sure the user you are authenticating over the CLI with is the same user that has access to the Hydrogen channel in the admin.

Noted.. Anyways how to linking to Headless Channel?

@graygilmore
Copy link
Contributor

Noted.. Anyways how to linking to Headless Channel?

This is not possible and isn't planned.

@HeisUser
Copy link

Noted.. Anyways how to linking to Headless Channel?

This is not possible and isn't planned.

I'm not understanding.. R u mean Headless channel hasn't to be used and ready yet?

@graygilmore
Copy link
Contributor

You cannot link a local Hydrogen storefront to something in the Headless channel. You can only link a Hydrogen storefront to something in the Hydrogen channel.

@HeisUser
Copy link

HeisUser commented Sep 10, 2024

You cannot link a local Hydrogen storefront to something in the Headless channel. You can only link a Hydrogen storefront to something in the Hydrogen channel.

I know the Hydrogen app (paid) on Sales Channels is not allowed to be linking the Storefronts in development mode.

Anyways, How to use & linking Headless app on Sales Channels ?
I'd followed the setup guides as follows:

@graygilmore
Copy link
Contributor

Anyways, How to use & linking Headless app on Sales Channels ?

You cannot link a local Hydrogen storefront to the Headless sales channel.

The only thing you can link is a Hydrogen storefront to the Hydrogen sales channel. If you plan on building with Hydrogen and hosting on Oxygen then uninstall the Headless sales channel. If you plan on building with Hydrogen and hosting on something other than Oxygen then you can keep the Headless sales channel but you won't be able to use some of the features of the CLI (like link and deploy).

@HeisUser
Copy link

Anyways, How to use & linking Headless app on Sales Channels ?

You cannot link a local Hydrogen storefront to the Headless sales channel.

The only thing you can link is a Hydrogen storefront to the Hydrogen sales channel. If you plan on building with Hydrogen and hosting on Oxygen then uninstall the Headless sales channel. If you plan on building with Hydrogen and hosting on something other than Oxygen then you can keep the Headless sales channel but you won't be able to use some of the features of the CLI (like link and deploy).

Thank you for your guides.

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

No branches or pull requests

5 participants