Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot destructure property 'client' of 'db.config.connection' as it is undefined. #183

Closed
yuri-popov opened this issue Sep 1, 2024 · 3 comments
Labels
bug Something isn't working Needs investigation Further information is requested

Comments

@yuri-popov
Copy link

Bug report

Describe the bug

When I start yarn sitemap generate I get the error:

/srv/app/node_modules/@strapi/database/dist/index.js:1014
  const { client } = db.config.connection;
          ^

TypeError: Cannot destructure property 'client' of 'db.config.connection' as it is undefined.
    at getDialect (/srv/app/node_modules/@strapi/database/dist/index.js:1014:11)
    at new Database (/srv/app/node_modules/@strapi/database/dist/index.js:6195:20)
    at Database.init (/srv/app/node_modules/@strapi/database/dist/index.js:6181:16)
    at Strapi.bootstrap (/srv/app/node_modules/@strapi/strapi/dist/Strapi.js:372:39)
    at Strapi.load (/srv/app/node_modules/@strapi/strapi/dist/Strapi.js:426:16)
    at async Command.<anonymous> (/srv/app/node_modules/strapi-plugin-sitemap/server/cli.js:25:17)
    at async Command.parseAsync (/srv/app/node_modules/commander/lib/command.js:923:5)

Steps to reproduce the behavior

yarn sitemap generate

Expected behavior

I use docker-compose.yml for strapi. Config:

strapi:
   build:
     context: ./strapi
   container_name: strapi
   environment:
     HOST: ${HOST}
     PORT: ${STRAPI_PORT}
     APP_KEYS: ${APP_KEYS}
     API_TOKEN_SALT: ${API_TOKEN_SALT}
     ADMIN_JWT_SECRET: ${ADMIN_JWT_SECRET}
     TRANSFER_TOKEN_SALT: ${TRANSFER_TOKEN_SALT}
     DATABASE_CLIENT: ${DATABASE_CLIENT}
     DATABASE_HOST: postgres # Здесь используем имя сервиса 'postgres', чтобы обеспечить связь контейнеров
     DATABASE_PORT: ${DATABASE_PORT}
     DATABASE_NAME: ${DATABASE_NAME}
     DATABASE_USERNAME: ${DATABASE_USERNAME}
     DATABASE_PASSWORD: ${DATABASE_PASSWORD}
     DATABASE_SSL: ${DATABASE_SSL}
     NODE_ENV: development
     AWS_S3_FORCE_PATH_STYLE: ${AWS_S3_FORCE_PATH_STYLE}
     AWS_S3_UPLOAD_BUCKET_NAME: ${AWS_S3_UPLOAD_BUCKET_NAME}
     AWS_S3_UPLOAD_BUCKET_URL: ${AWS_S3_UPLOAD_BUCKET_URL}
     AWS_S3_UPLOAD_MAX_SIZE: ${AWS_S3_UPLOAD_MAX_SIZE}
     AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
     AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
     AWS_S3_PORT: ${AWS_S3_PORT}
   ports:
     - ${STRAPI_PORT}:1337
   volumes:
     - ./strapi/src:/srv/app
     - /srv/app/node_modules
   depends_on:
     - postgres

System

  • Node.js version: 20.16.0
  • NPM version: 10.8.1
  • Strapi version: 4.25.7
  • Plugin version: 3.2.0
  • Database: postgres
  • Operating system: Windows 11 (WSL 2)
@boazpoolman boazpoolman added the invalid This doesn't seem right label Sep 1, 2024
@boazpoolman
Copy link
Member

This seems like a duplicate of #171

@yuri-popov
Copy link
Author

This seems like a duplicate of #171
This matches the comment, but not the original issue.

@boazpoolman boazpoolman added bug Something isn't working Needs investigation Further information is requested and removed invalid This doesn't seem right labels Sep 3, 2024
@boazpoolman
Copy link
Member

This issue was fixed and released with v3.2.1 of the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Needs investigation Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants