The page is not loading properly
Describe the bug When I apply Oldtwitter, the same error keeps appearing no matter which page I load.
Screenshots
Browser Google Chrome v140.0.7339.81 (Official Build)
Links All pages compatible with OldTwitter
OldTwitter version v1.9.6.3
same here
Also experiencing this on Librewolf-bin(AUR) Closing the popup leads to "Solver errored during initialization" now. Good that it gives a "for-dummies" explanation for someone like myself.
Fix for X's new Sentry-wrapped ondemand.s...js payload (Fixes "Header not found" & t.r is not a function)
X has updated their security header script to place the module exports (t.r(W), t.d(...)) inside the function closure surrounded by minified Sentry telemetry. Because of this change:
The old regex
(\d+):(.+)=>.+default:()=>(\w)}); fails since there is no closing }); immediately after the default export. If you try to strip the end of the module as the old patch did, it destroys the initialization wrapper, causing t.r is not a function because the Webpack mock variables (wreq.r, wreq.d) are initialized lazily inside function wreq(id) and the new X module invokes them immediately. Here is the complete patch for
sandbox.html to adapt to the new syntax dynamically while preserving the entire Sentry-wrapped payload safely.
Replace the let headerRegex... block down to solver = window._CHALLENGE()(); (around line 41-106) with this:
html // Updated regex to handle X's new Sentry-wrapped security scripts let headerRegex = /(\d+):([a-zA-Z0-9_$(),]+=?>\s*{)(.?default:\s()\s*=>\s*(\w+))/; let headerMatch = challengeData.match(headerRegex);
// Fallback to old regex if the new one fails (for backwards compatibility)
if (!headerMatch) {
headerRegex = /(\d+):(.+)=>.+default:\(\)=>(\w)}\);/;
headerMatch = challengeData.match(headerRegex);
}
if (!headerMatch) {
console.error('Uh oh, header not found!! Report to https://github.com/dimdenGD/OldTwitter/issues');
event.source.postMessage({ action: 'initError', error: `Header not found at ${data.challengeCode} (${String(challengeData).slice(0, 500)}...)` }, event.origin);
initError = true;
return;
}
// Safely prepend the _CHALLENGE expose to the start of the module body to avoid mutating Sentry telemetry structure
// Uses differing replace patterns based on which regex matched.
const patchedChallengeData = headerRegex.source.includes('.*?')
? challengeData.replace(headerRegex, '$1:$2window._CHALLENGE=()=>$4;$3')
: challengeData.replace(headerRegex, '$1:$2=>{window._CHALLENGE=()=>$3;');
eval(patchedChallengeData);
let id = headerMatch[1];
const chunks = self.webpackChunk_twitter_responsive_web || [];
const registry = {};
for (const payload of chunks) {
if (payload && payload[1]) Object.assign(registry, payload[1]);
}
// 2) A minimal __webpack_require__ with a cache and a few helpers
const cache = {};
function wreq(id) {
if (cache[id]) return cache[id].exports;
const factory = registry[id];
if (!factory) throw new Error("No module with id " + id);
const module = { id, loaded: false, exports: {} };
cache[id] = module;
// 3) Execute the module factory: (module, exports, __webpack_require__)
factory(module, module.exports, wreq);
module.loaded = true;
return module.exports;
}
// Minimal helpers used by many bundles (moved outside so they exist before module execution)
wreq.d = (exports, definition) => {
for (const key in definition) {
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
}
};
wreq.r = (exports) => {
if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
}
Object.defineProperty(exports, "__esModule", { value: true });
};
wreq.n = (mod) => {
const getter = mod && mod.__esModule ? () => mod.default : () => mod;
wreq.d(getter, { a: getter });
return getter;
};
wreq.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
// Call wreq to properly execute the module with a true mock environment
wreq(id);
solver = window._CHALLENGE()();
Same here, since today the extension has not been working, getting an error message
The issue has ceased for me. Not sure if it has for anyone else. I wish it were easier to track when the issue was unrelated to this, but it's a little bit hard to discern sometimes.
I've started to get this error as of a few minutes ago on my backup X account