bigcommerce / catalyst

Catalyst for Composable Commerce
https://catalyst-demo.site
MIT License
79 stars 51 forks source link

Customer Login is not working when I scaffold a Catalyst application #1037

Open Pedro-Silva-MM opened 3 weeks ago

Pedro-Silva-MM commented 3 weeks ago

Describe the bug

When starting a new Catalyst project connected to my BigCommerce store, the customer login functionality does not work. This issue occurs after following the instructions to create a new channel for the Catalyst project. The login attempt returns an error indicating that “Operation cannot be performed as the storefront channel is not live,” even though the channel shows up as active in the BigCommerce admin panel.

To Reproduce

Steps to reproduce the behavior:

1.  Run the command pnpm create @bigcommerce/catalyst@latest
2.  Follow the prompts:
•   Name your project: <project-name>
•   Connect to a BigCommerce store: Yes
•   Authorize the device code at https://login.bigcommerce.com/device/connect
•   Create a new channel: Yes
•   Name the new channel: <channel_name>
3.  Navigate to the project directory: cd <project_name>
4.  Start the development server: pnpm run dev
5.     Register a customer on http://localhost:3000/login/register-customer/
6.  Attempt to log in using the login function in http://localhost:3000/login/

Expected behavior

The customer should be able to log in successfully.

Screenshots

image

I've added a log to when the login happens and here is the response.

image

The storefront channel shows up as active on https://.mybigcommerce.com/manage/channel-manager

chanceaclark commented 3 weeks ago

Hey @Pedro-Silva-MM, did you just change your BigCommerce storefront from prelaunch to active status? If so, it does take a little time to propagate.

Pedro-Silva-MM commented 3 weeks ago

Hey, thanks for the quick response.

I assume that you are referring to the storefront channel, if so I didn't. As far as I can tell the channel is created during the CLI setup. I've been trying to figure out whats wrong for some hours, I'm not sure if a propagation issue would take that long.

I don't know if it matters but I'm on BigCommerce free trial.

chanceaclark commented 3 weeks ago

Can you provide the full url to your store? https://store-{{storeHash}}.mybigcommerce.com/

Pedro-Silva-MM commented 3 weeks ago

https://store-amf0e6ddtt.mybigcommerce.com

Pedro-Silva-MM commented 2 weeks ago

Just reproduced the same issue with a fresh account.

chanceaclark commented 2 weeks ago

https://store-amf0e6ddtt.mybigcommerce.com

Try again on this storefront again. I turned your Catalyst channel to active and set the BigCommerce storefront to inactive. That's how it should be setup for Catalyst + Redirected Checkout.

If it's still happening, can you provide of the following information:

  1. The channel id used in your .env.local file.
  2. The version of next you are using (or screenshot the output of pnpm why next)
Pedro-Silva-MM commented 2 weeks ago

Hey, here is what I did:

  1. Created a fresh catalyst application again with pnpm create @bigcommerce/catalyst@latest
  2. During the CLI setup I chose to connect with my BigCommerce store, and to my catalyst channel
  3. Finished the setup and ran pnpm run dev
  4. Only thing that shows up on localhost:3000 is a maintenance page image
  5. Tried creating another catalyst project but connecting to a different channel, activated the channel on the BigCommerce admin UI and got the same result on localhost:3000

Here is the channel Id used on my .env.local on my first attempt: 1598252 Here is the channel Id I used during the second : 1

Here is the output of pnpm why next :

image
chanceaclark commented 2 weeks ago

Hey @Pedro-Silva-MM, I seem to have figured out this issue. Essentially our API is reading the storefront status from the default channel (1) if you don't have a specific feature flag enabled for your store. It shouldn't matter if you have the FF enabled or not, when trying to read the status from another channel – in your case 1598252. I am passing this along to the team that handles that API interaction to try and get it resolved.

In the meantime, I do believe there is a "fix", that's not ideal. Go into Channel Manager in the Control Panel and change the default channel 1 to be active. You might have to make the other channel inactive in order to active the default channel as we have storefront limits in place. Let us know if that doesn't work.

Pedro-Silva-MM commented 2 weeks ago

Hey @chanceaclark, thanks for the support.

The fix you provided worked, thank you.

chanceaclark commented 2 weeks ago

Awesome glad it worked.

Keeping this issue open till we resolve it on the BC side.