{"record":{"id":"205bc501adf9c727","repo":"GrapesJS/grapesjs","slug":"failed-to-send-telemetry-data-await-response-tex","errorCode":null,"errorMessage":"Failed to send telemetry data ${await response.text()}","messagePattern":"Failed to send telemetry data (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/core/src/editor/view/EditorView.ts","lineNumber":85,"sourceCode":"    }\n\n    const sessionKeyPrefix = 'gjs_telemetry_sent_';\n    const { version } = this.model;\n    const sessionKey = `${sessionKeyPrefix}${version}`;\n\n    if (sessionStorage.getItem(sessionKey)) {\n      // Telemetry already sent for version this session\n      return;\n    }\n\n    const url = 'https://app.grapesjs.com';\n    const response = await fetch(`${url}/api/gjs/telemetry/collect`, {\n      method: 'POST',\n      body: JSON.stringify({ domain, version }),\n    });\n\n    if (!response.ok) {\n      throw new Error(`Failed to send telemetry data ${await response.text()}`);\n    }\n\n    sessionStorage.setItem(sessionKey, 'true');\n\n    Object.keys(sessionStorage).forEach((key) => {\n      if (key.startsWith(sessionKeyPrefix) && key !== sessionKey) {\n        sessionStorage.removeItem(key);\n      }\n    });\n\n    this.trigger(EditorEvents.telemetryInit);\n  }\n}\n","sourceCodeStart":67,"sourceCodeEnd":99,"githubUrl":"https://github.com/GrapesJS/grapesjs/blob/2bdeda85b82b8b9ceae42fd6558cbbcae5ec2d21/packages/core/src/editor/view/EditorView.ts#L67-L99","documentation":"GrapesJS EditorView optionally sends anonymous telemetry (domain, version) to `${telemetryUrl}/api/gjs/telemetry/collect`. If the POST returns a non-OK status, it throws an Error embedding the response body. Because this runs in the editor constructor, a failing telemetry endpoint can abort editor initialization.","triggerScenarios":"Creating an editor with telemetry enabled while the telemetry endpoint is unreachable, returns 4xx/5xx, or is blocked (ad blockers, corporate proxies, offline environments).","commonSituations":"Self-hosted GrapesJS with default telemetry URL behind a firewall; offline/intranet usage; ad-blockers blocking the /api/gjs/telemetry/collect path; misconfigured telemetry URL.","solutions":["Disable telemetry in the editor config (there is a telemetry/telemetryUrl option) if you don't need it.","Check network access to the telemetry URL and any proxy/ad-block interference.","Wrap editor creation or upgrade your GrapesJS version — newer versions handle telemetry failures gracefully instead of throwing in the constructor.","If self-hosting telemetry, verify the `/api/gjs/telemetry/collect` endpoint returns 2xx."],"exampleFix":"// before\nconst editor = grapesjs.init({ container: '#gjs' }); // constructor throws if telemetry POST fails\n// after\nconst editor = grapesjs.init({ container: '#gjs', telemetry: false });","handlingStrategy":"fallback","validationCode":"const telemetryUrl = config.telemetryUrl;\nif (telemetryUrl) {\n  try {\n    const r = await fetch(`${telemetryUrl}/api/gjs/telemetry/collect`, { method: 'OPTIONS' });\n    if (!r.ok) config = { ...config, telemetry: false };\n  } catch { config = { ...config, telemetry: false }; }\n}","typeGuard":"null","tryCatchPattern":"try {\n  const editor = grapesjs.init(config);\n} catch (err) {\n  if (String(err.message).startsWith('Failed to send telemetry data')) {\n    const editor = grapesjs.init({ ...config, telemetry: false });\n  } else throw err;\n}","preventionTips":["Disable telemetry in offline/intranet/private deployments","Use a GrapesJS version where telemetry failures don't throw in the constructor","Whitelist the telemetry endpoint in ad-blockers/proxies if telemetry is desired"],"tags":["network","telemetry","fetch","editor-init"],"backgroundTag":"http-request-failed","analyzedSha":"2bdeda85b82b8b9ceae42fd6558cbbcae5ec2d21","analyzedAt":"2026-08-30T11:47:52.267Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}