# Generate a hex-encoded 32-byte random key. Use `openssl rand -hex 32` in your
# terminal to generate a random value.
SECRET_KEY=generate_a_new_key
{"error":"Invalid key length","level":"error","message":"Failed to encrypt database column (accessToken). The SECRET_KEY environment variable is not the correct length.","stack":"RangeError: Invalid key length\n at Cipheriv.createCipherBase (node:internal/crypto/cipher:121:19)\n at Cipheriv.createCipherWithIV (node:internal/crypto/cipher:140:3)\n at new Cipheriv (node:internal/crypto/cipher:243:3)\n at Object.createCipheriv (node:crypto:147:10)\n at Object.createCipheriv (/opt/outline/node_modules/dd-trace/packages/datadog-instrumentations/src/crypto.js:29:27)\n at UserAuthentication.set (/opt/outline/node_modules/sequelize-encrypted/index.js:48:33)\n at UserAuthentication.set (/opt/outline/build/server/models/decorators/Encrypted.js:55:59)\n at UserAuthentication.set (/opt/outline/node_modules/sequelize/lib/model.js:2256:32)\n at UserAuthentication.set (/opt/outline/node_modules/sequelize/lib/model.js:2241:18)\n at UserAuthentication._initValues (/opt/outline/node_modules/sequelize/lib/model.js:156:10)\n at new Model (/opt/outline/node_modules/sequelize/lib/model.js:116:10)\n at new Model (/opt/outline/node_modules/sequelize-typescript/dist/model/model/model.js:14:9)\n at new Model (/opt/outline/build/server/models/base/Model.js:24:5)\n at new IdModel (/opt/outline/build/server/models/base/IdModel.js:20:5)\n at new UserAuthentication (/opt/outline/build/server/models/UserAuthentication.js:29:5)\n at new user_authentication (/opt/outline/build/server/models/decorators/Fix.js:21:7)\n at user_authentication.build (/opt/outline/node_modules/sequelize/lib/model.js:1344:12)\n at Model.<computed> (/opt/outline/node_modules/sequelize-typescript/dist/model/model/model.js:128:28)\n at Model.<computed> [as build] (/opt/outline/node_modules/sequelize-typescript/dist/model/model/model.js:138:28)\n at /opt/outline/node_modules/sequelize/lib/model.js:1358:43\n at Array.map (<anonymous>)\n at user_authentication.bulkBuild (/opt/outline/node_modules/sequelize/lib/model.js:1358:22)"}
Replacing the helper with hash:64 in template.toml generates an appropriate hex key (64-chars = 32-bytes), making the template usable immediately.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/Dokploy/templates/pull/167
**Author:** [@deankerr](https://github.com/deankerr)
**Created:** 6/5/2025
**Status:** ✅ Merged
**Merged:** 6/20/2025
**Merged by:** [@Siumauricio](https://github.com/Siumauricio)
**Base:** `main` ← **Head:** `fix-outline-secret-key`
---
### 📝 Commits (1)
- [`11740ae`](https://github.com/Dokploy/templates/commit/11740aedc0fc672b8379ca591a07a99590d14d4c) fix(blueprint): generate 32-byte hex secret_key with hash helper
### 📊 Changes
**1 file changed** (+1 additions, -1 deletions)
<details>
<summary>View changed files</summary>
📝 `blueprints/outline/template.toml` (+1 -1)
</details>
### 📄 Description
Outline expects a hex-encoded 32-byte random `SECRET_KEY` value, but currently a `base64:32` value is generated, making authentication impossible.
[outline/.env.sample](https://github.com/outline/outline/blob/6a16dc07c154712fbe0ff2cf254a8f8ee97ad4f6/.env.sample#L25-L27)
```
# Generate a hex-encoded 32-byte random key. Use `openssl rand -hex 32` in your
# terminal to generate a random value.
SECRET_KEY=generate_a_new_key
```
```json
{"error":"Invalid key length","level":"error","message":"Failed to encrypt database column (accessToken). The SECRET_KEY environment variable is not the correct length.","stack":"RangeError: Invalid key length\n at Cipheriv.createCipherBase (node:internal/crypto/cipher:121:19)\n at Cipheriv.createCipherWithIV (node:internal/crypto/cipher:140:3)\n at new Cipheriv (node:internal/crypto/cipher:243:3)\n at Object.createCipheriv (node:crypto:147:10)\n at Object.createCipheriv (/opt/outline/node_modules/dd-trace/packages/datadog-instrumentations/src/crypto.js:29:27)\n at UserAuthentication.set (/opt/outline/node_modules/sequelize-encrypted/index.js:48:33)\n at UserAuthentication.set (/opt/outline/build/server/models/decorators/Encrypted.js:55:59)\n at UserAuthentication.set (/opt/outline/node_modules/sequelize/lib/model.js:2256:32)\n at UserAuthentication.set (/opt/outline/node_modules/sequelize/lib/model.js:2241:18)\n at UserAuthentication._initValues (/opt/outline/node_modules/sequelize/lib/model.js:156:10)\n at new Model (/opt/outline/node_modules/sequelize/lib/model.js:116:10)\n at new Model (/opt/outline/node_modules/sequelize-typescript/dist/model/model/model.js:14:9)\n at new Model (/opt/outline/build/server/models/base/Model.js:24:5)\n at new IdModel (/opt/outline/build/server/models/base/IdModel.js:20:5)\n at new UserAuthentication (/opt/outline/build/server/models/UserAuthentication.js:29:5)\n at new user_authentication (/opt/outline/build/server/models/decorators/Fix.js:21:7)\n at user_authentication.build (/opt/outline/node_modules/sequelize/lib/model.js:1344:12)\n at Model.<computed> (/opt/outline/node_modules/sequelize-typescript/dist/model/model/model.js:128:28)\n at Model.<computed> [as build] (/opt/outline/node_modules/sequelize-typescript/dist/model/model/model.js:138:28)\n at /opt/outline/node_modules/sequelize/lib/model.js:1358:43\n at Array.map (<anonymous>)\n at user_authentication.bulkBuild (/opt/outline/node_modules/sequelize/lib/model.js:1358:22)"}
```
Replacing the helper with `hash:64` in `template.toml` generates an appropriate hex key (64-chars = 32-bytes), making the template usable immediately.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/Dokploy/templates/pull/167
Author: @deankerr
Created: 6/5/2025
Status: ✅ Merged
Merged: 6/20/2025
Merged by: @Siumauricio
Base:
main← Head:fix-outline-secret-key📝 Commits (1)
11740aefix(blueprint): generate 32-byte hex secret_key with hash helper📊 Changes
1 file changed (+1 additions, -1 deletions)
View changed files
📝
blueprints/outline/template.toml(+1 -1)📄 Description
Outline expects a hex-encoded 32-byte random
SECRET_KEYvalue, but currently abase64:32value is generated, making authentication impossible.outline/.env.sample
Replacing the helper with
hash:64intemplate.tomlgenerates an appropriate hex key (64-chars = 32-bytes), making the template usable immediately.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.