rigby-sh / solace-medusa-starter

https://solace-medusa-starter.vercel.app
19 stars 8 forks source link

error "Please set app.keys in config/server.js" #96

Open zzell opened 2 days ago

zzell commented 2 days ago

I'm seeing the following error during initial setup I couldn't find any mentions in the documentation about how to set the app.keys for strapi.

npm run develop

> my-strapi@0.1.0 develop
> strapi develop

✔ Cleaning dist dir (8ms)
⠋ Loading Strapi⠋ Building build context
[INFO] Including the following ENV variables as part of the JS bundle:
    - ADMIN_PATH
    - STRAPI_ADMIN_BACKEND_URL
    - STRAPI_TELEMETRY_DISABLED
✔ Building build context (113ms)
✔ Creating admin (198ms)
⠦ Loading Strapi(node:80862) Warning: S3 configuration options passed at root level of the plugin's providerOptions is deprecated and will be removed in a future release. Please wrap them inside the 's3Options:{}' property.
(Use `node --trace-warnings ...` to show where the warning was created)
⠧ Loading Strapi[ERROR]  There seems to be an unexpected error, try again with --debug for more information

┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│
│   Error: Middleware "strapi::session": App keys are required. Please set app.keys in config/server.js (ex: keys: ['myKeyA', 'myKeyB'])
│   at instantiateMiddleware (/Users/user/test-test/solace-medusa-starter-strapi/node_modules/@strapi/core/dist/services/server/middleware.js:13:13)
│   at Module.resolveMiddlewares (/Users/user/test-test/solace-medusa-starter-strapi/node_modules/@strapi/core/dist/services/server/middleware.js:43:18)
│   at registerApplicationMiddlewares
│   (/Users/user/test-test/solace-medusa-starter-strapi/node_modules/@strapi/core/dist/services/server/register-middlewares.js:44:40)
│   at async Object.initMiddlewares (/Users/user/test-test/solace-medusa-starter-strapi/node_modules/@strapi/core/dist/services/server/index.js:69:7)
│   at async Strapi.bootstrap (/Users/user/test-test/solace-medusa-starter-strapi/node_modules/@strapi/core/dist/Strapi.js:365:5)
│   at async Strapi.load (/Users/user/test-test/solace-medusa-starter-strapi/node_modules/@strapi/core/dist/Strapi.js:315:5)
│   at async Module.develop (/Users/user/test-test/solace-medusa-starter-strapi/node_modules/@strapi/strapi/dist/node/develop.js:177:28)
│   at async action (/Users/user/test-test/solace-medusa-starter-strapi/node_modules/@strapi/strapi/dist/cli/commands/develop.js:18:5)
│   at async Command.parseAsync (/Users/user/test-test/solace-medusa-starter-strapi/node_modules/commander/lib/command.js:923:5)
│   at async runCLI (/Users/user/test-test/solace-medusa-starter-strapi/node_modules/@strapi/strapi/dist/cli/index.js:75:3)
│
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
agnwoj99 commented 2 days ago

Hello @zzell. You should add such envs to your project:

# Server
HOST=0.0.0.0
PORT=1337

# Secrets
APP_KEYS="toBeModified1,toBeModified2"
API_TOKEN_SALT=tobemodified
ADMIN_JWT_SECRET=tobemodified
TRANSFER_TOKEN_SALT=tobemodified
JWT_SECRET=tobemodified

# Database
DATABASE_URL=tobemodified
DATABASE_CLIENT=tobemodified
DATABASE_HOST=tobemodified
DATABASE_PORT=tobemodified
DATABASE_NAME=tobemodified
DATABASE_USERNAME=tobemodified
DATABASE_PASSWORD=tobemodified
DATABASE_SSL=false

# Storage
DO_SPACE_PATH=tobemodified
DO_SPACE_ACCESS_KEY=tobemodified
DO_SPACE_SECRET_KEY=tobemodified
DO_SPACE_REGION=tobemodified
DO_SPACE_ENDPOINT=tobemodified
DO_SPACE_BUCKET=tobemodified
SPACE_URL=tobemodified

If you have trouble putting this up directly from our repository, create a Strapi instance and import our configuration files: Download config file

I hope my answer was helpful!

zzell commented 1 day ago

hi, @agnwoj99 thanks for the answer, it helped. i did setup the new strapi instance with

yarn create strapi

and then imported the file you've provided via

yarn strapi import -f strapi-config.tar.gz

i also created the revalidation key as mentioned in the documentation and mapped it in the webhooks section in strapi admin, but now i'm getting this exception:

> 28 |     throw new Error('Failed to fetch data')

and here are the logs from strapi:

[2024-11-12 23:07:53.804] http: POST /admin/webhooks (80 ms) 201
[2024-11-12 23:07:53.939] http: GET /admin/webhooks/2 (46 ms) 200
[2024-11-12 23:08:10.972] http: GET /api/collections?&populate=* (6 ms) 404
[2024-11-12 23:08:11.290] http: GET /api/homepage?populate[1]=HeroBanner&populate[2]=HeroBanner.CTA&populate[3]=HeroBanner.Image (5 ms) 404
[2024-11-12 23:08:11.304] http: GET /api/homepage?populate[1]=MidBanner&populate[2]=MidBanner.CTA&populate[3]=MidBanner.Image (3 ms) 404
[2024-11-12 23:08:11.304] http: GET /api/blogs?populate[1]=FeaturedImage&sort=createdAt:desc&pagination[start]=0&pagination[limit]=3 (1 ms) 404

this issue was mentioned here: https://github.com/rigby-sh/solace-medusa-starter/issues/95 and you've replied:

As for the file provider - once you import on the config, the images should display correctly for you. But in case you want to manage photos, you have to plug in your resource, unfortunately.

i expected the frontstore to eventually run even without the S3 with static pictures from local disc. Does this mean that the S3 is the only option and is required for this starter? if so - where can i download the pictures for the starter?

thanks!

fuxianwei commented 1 day ago

I also encountered the same problem, I only imported your configuration file, but there was no actual data, so the front-end could not run. I want to import your data or insert strapi data myself, but there is no s3 bucket at present