{"record":{"id":"0737459dc235a0b7","repo":"facebook/react","slug":"createfasthash-is-not-supported-in-this-environmen","errorCode":null,"errorMessage":"createFastHash is not supported in this environment.","messagePattern":"createFastHash is not supported in this environment\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-flight-server-fb/src/ReactServerStreamConfigFB.js","lineNumber":232,"sourceCode":"}\n\nexport function byteLengthOfChunk(chunk: Chunk | PrecomputedChunk): number {\n  return typeof chunk === 'string'\n    ? Buffer.byteLength(chunk, 'utf8')\n    : chunk.byteLength;\n}\n\nexport function byteLengthOfBinaryChunk(chunk: BinaryChunk): number {\n  return chunk.byteLength;\n}\n\nexport function closeWithError(destination: Destination, error: mixed): void {\n  // $FlowFixMe[incompatible-type]: This is an Error object or the destination accepts other types.\n  destination.destroy(error);\n}\n\nexport function createFastHash(_input: string): string | number {\n  throw new Error('createFastHash is not supported in this environment.');\n}\n\nexport function readAsDataURL(blob: Blob): Promise<string> {\n  return blob.arrayBuffer().then(arrayBuffer => {\n    const encoded = Buffer.from(arrayBuffer).toString('base64');\n    const mimeType = blob.type || 'application/octet-stream';\n    return 'data:' + mimeType + ';base64,' + encoded;\n  });\n}\n","sourceCodeStart":214,"sourceCodeEnd":242,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-flight-server-fb/src/ReactServerStreamConfigFB.js#L214-L242","documentation":"ReactServerStreamConfigFB is the Flight-server stream config for Meta's FB runtime; it implements that runtime's stream helpers but deliberately stubs createFastHash to throw, since no fast hasher exists in this environment. createFastHash is consumed by ReactFizzHooks' createPostbackActionStateKey to compress a useActionState hook's key path into a postback key — and that hash is only computed when useActionState was called without a permalink.","triggerScenarios":"Server rendering (Flight/Fizz under the react-flight-server-fb build) a component that calls useActionState(action, initialState) with no third permalink argument: createPostbackActionStateKey hashes the key path via createFastHash and hits the throwing stub. Passing a permalink returns 'p' + permalink and skips the hash entirely.","commonSituations":"Meta-internal www builds rendering progressive-enhancement forms in an environment that does not supply the native fast hash; OSS consumers accidentally resolving the FB fork of the stream config through bundler aliases.","solutions":["Pass a permalink as the third argument to useActionState — permalink-based keys bypass createFastHash completely","Ensure the FB runtime module expected to supply hashing is initialized before rendering","Fix bundler aliases so non-FB environments resolve ReactServerStreamConfigNode/Browser instead of the FB fork"],"exampleFix":"// before\nconst [state, formAction] = useActionState(signupAction, initialState);\n\n// after\nconst [state, formAction] = useActionState(signupAction, initialState, 'newsletter-signup');","handlingStrategy":"validation","validationCode":"// A permalink makes the postback key hash-free, avoiding createFastHash entirely\nconst hasPermalink = typeof permalink === 'string' && permalink.length > 0;\nconst [state, formAction] = hasPermalink\n  ? useActionState(action, initialState, permalink)\n  : useActionState(action, initialState, 'stable-key'); // always supply one in FB builds","typeGuard":null,"tryCatchPattern":"try {\n  const html = await renderToPipeableStream(<Form />);\n  return html;\n} catch (e) {\n  if (e instanceof Error && e.message.includes('createFastHash is not supported')) {\n    throw new Error(\n      'useActionState was called without a permalink in an environment without fast hashing — add a permalink argument'\n    );\n  }\n  throw e;\n}","preventionTips":["Always pass a permalink as the third argument to useActionState in FB Flight server builds","Confirm the FB runtime stream config (with hashing support) is initialized before rendering","Verify bundler aliases resolve the intended ReactServerStreamConfig fork per environment"],"tags":["react-flight","server-components","useactionstate","forms","meta-internal"],"backgroundTag":"unsupported-runtime-api","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}