-
Notifications
You must be signed in to change notification settings - Fork 337
Make generate script tolerant to missing environment variables with fallback endpoint #2550
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
base: canary
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
|
…sing Co-authored-by: bookernath <[email protected]>
|
@copilot fix the build failure due to prettier rules; you can
Attention: Next.js now collects completely anonymous telemetry regarding usage. ./scripts/generate.cjs info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/app/api-reference/config/eslint#disabling-rules |
Co-authored-by: bookernath <[email protected]>
... Fixed the prettier formatting issues by running ESLint with the --fix flag. Removed trailing whitespace from lines 47 and 50 in the generate.cjs file. (a8963bd) Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Problem
The generate script (
core/scripts/generate.cjs) currently throws errors when required BigCommerce environment variables are not configured:This prevents builds from completing during initial development setup or in CI/CD environments where store-specific credentials aren't available, making onboarding more difficult for new developers.
Solution
Updated the generate script to use a public fallback endpoint when environment variables are missing, while preserving existing behavior when they are configured.
Key Changes
Fallback Endpoint: When
BIGCOMMERCE_STORE_HASHis not set, the script now uses the public endpointhttps://cxm-prd.bigcommerceapp.com/api/graphql-schemainstead of throwing an error.Conditional Authorization: The
Authorization: Bearer {token}header is only included when a storefront token is available, allowing the public endpoint to work without authentication.Graceful Degradation: Functions
getStoreHash()andgetToken()now returnnullinstead of throwing errors when environment variables are missing.Behavior
Without environment variables:
With environment variables (unchanged):
Benefits
This change allows developers to get started immediately with
pnpm run devorpnpm run buildwithout needing to configure store credentials first, while still supporting the full store-specific functionality once environment variables are properly set up.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
cxm-prd.bigcommerceapp.comnode scripts/generate.cjs(dns block)curl -I REDACTED(dns block)nslookup cxm-prd.bigcommerceapp.com(dns block)googlechromelabs.github.ionode install.mjs(dns block)https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.55/linux64/chrome-headless-shell-linux64.zipnode install.mjs(http block)store-test.mybigcommerce.comnode ./scripts/generate.cjs(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.