Skip to content

Prevent telemetry disabling in OSS edition without WCP connection#4843

Merged
adrians5j merged 15 commits intonextfrom
copilot/implement-oss-telemetry-error-check
Jan 6, 2026
Merged

Prevent telemetry disabling in OSS edition without WCP connection#4843
adrians5j merged 15 commits intonextfrom
copilot/implement-oss-telemetry-error-check

Conversation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

image

OSS users must not disable telemetry unless connected to Webiny Control Panel (enterprise feature) or working in the webiny-js development repository.

Changes

  • Added IsWcpEnabled abstraction and implementation: Created new abstraction to check WCP connection status using GetProjectIdService instead of direct environment variable access. Provides cleaner separation of concerns and better testability.

  • Added IsWebinyJsRepo abstraction and implementation: Created new abstraction to detect the webiny-js development repository by checking for the existence of packages/admin-ui directory. This allows developers working on Webiny itself to bypass telemetry restrictions.

  • Added EnsureTelemetryEnabledForOss BeforeDeploy hook: Validates telemetry state before deployment by checking IsTelemetryEnabled, IsWcpEnabled, and IsWebinyJsRepo services. Throws GracefulError when telemetry is disabled without WCP connection in non-development environments.

  • Registered built-in implementations in DI container: Auto-loaded in createProjectSdkContainer.ts after composite registration, ensuring validation runs on every deployment without requiring explicit user configuration.

Behavior

// webiny-js dev repo - validation skipped
<Project.Telemetry enabled={false} />  // ✓ Deploys successfully (dev environment)

// OSS user without WCP - deployment blocked
<Project.Telemetry enabled={false} />  
// Error: "You are trying to disable telemetry in the open-source edition..."

// Enterprise user with WCP - allowed
WCP_PROJECT_ID="org/proj"
<Project.Telemetry enabled={false} />  // ✓ Deploys successfully

Pattern follows existing built-in hooks like EnsureCoreDeployedBeforeApiDeploy and uses proper abstractions for improved maintainability.

Original prompt

i need to impl the following req

  • if someone who is on the open-source version tries to disable it, to throw an error during the build saying that this cannot be done in the OSS edition of Webiny

Basically, we want to check if WCP is connected. If so, then allow disable telemery (via <Project.Telemetry enabled={false} />, as seen in #file:webiny.config.tsx

If not WCP connected, then throw an error.

Notes:

  • we want to do this in a before-deploy hook (BeforeDeploy abs)
  • you can use #file:EnsureCoreDeployedBeforeApiDeploy.ts
  • you can use const wcpProjectId = process.env.WCP_PROJECT_ID || ""; as seen in #file:ProjectInfoService to determine whether WCP conn exists

The user has attached the following files from their workspace:

  • webiny.config.tsx
  • packages/project/src/extensions/Project/EnsureCoreDeployedBeforeApiDeploy.ts
  • packages/project/src/services/ProjectInfoService

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits January 5, 2026 16:14
Co-authored-by: adrians5j <5121148+adrians5j@users.noreply.github.com>
Co-authored-by: adrians5j <5121148+adrians5j@users.noreply.github.com>
…r check

Co-authored-by: adrians5j <5121148+adrians5j@users.noreply.github.com>
Co-authored-by: adrians5j <5121148+adrians5j@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement error check for telemetry disable in OSS version Prevent telemetry disabling in OSS edition without WCP connection Jan 5, 2026
Copilot AI requested a review from adrians5j January 5, 2026 16:22
@Pavel910 Pavel910 added this to the 6.0.0 milestone Jan 5, 2026
@adrians5j
Copy link
Member

let's do one more thing here...

In packages/project/src/extensions/Project/EnsureTelemetryEnabledForOss.ts:9, let's actually use IsWcpEnabled abstraction. It does not exist, you need to create it.

Also, let's do one other abstraction and that's IsWebinyJsRepo. Basically, we need to distiguish between real Webiny project and a webiny-js dev repo (repo where Webiny is developed). The impl basically checks existence of packages/admin-ui pkg. For example I had this the other day

 const adminUiPkgPath = path.join(projectRootFolderPath, "packages", "admin-ui");

    const isWebinyJsRepo = fs.existsSync(adminUiPkgPath);

Once we have that abs/impl, then use it in the new EnsureTelemetryEnabledForOss impl. Basically, we don't care on what tier the project is when webiny-js repo === true.

@copilot

…tryEnabledForOss

Co-authored-by: adrians5j <5121148+adrians5j@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 6, 2026

let's do one more thing here...

In packages/project/src/extensions/Project/EnsureTelemetryEnabledForOss.ts:9, let's actually use IsWcpEnabled abstraction. It does not exist, you need to create...

Done! Created IsWcpEnabled and IsWebinyJsRepo abstractions and updated EnsureTelemetryEnabledForOss to use them. The implementation now:

  • Uses IsWcpEnabled instead of direct env var check
  • Skips validation for webiny-js dev repo using IsWebinyJsRepo
  • Follows the exact pattern you provided for detecting the dev repo

Commit: fd435af

adrians5j and others added 3 commits January 6, 2026 06:47
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: adrians5j <5121148+adrians5j@users.noreply.github.com>
@adrians5j adrians5j marked this pull request as ready for review January 6, 2026 06:07
@adrians5j adrians5j merged commit 814301a into next Jan 6, 2026
15 of 16 checks passed
@adrians5j adrians5j deleted the copilot/implement-oss-telemetry-error-check branch March 5, 2026 08:22
Copilot AI added a commit to loomery/aibenchmarking-webiny-js-backend-ai-arena that referenced this pull request Mar 6, 2026
webiny#4843)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: adrians5j <5121148+adrians5j@users.noreply.github.com>
Co-authored-by: adrians5j <adrian@webiny.com>
Co-authored-by: Adrian Smijulj <adrian1358@gmail.com>
Copilot AI added a commit to loomery/aibenchmarking-webiny-js-backend-ai-arena that referenced this pull request Mar 6, 2026
webiny#4843)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: adrians5j <5121148+adrians5j@users.noreply.github.com>
Co-authored-by: adrians5j <adrian@webiny.com>
Co-authored-by: Adrian Smijulj <adrian1358@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants