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

Net::IMAP::BadResponseError: Command received in Invalid state. #519

Open
johannmoraes opened this issue Jul 14, 2023 · 0 comments
Open

Comments

@johannmoraes
Copy link

Hi,

I got the error below when trying to enable IMAP.

rake aborted!
Net::IMAP::BadResponseError: Command received in Invalid state.
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/net-imap-0.2.3/lib/net/imap.rb:1247:in `get_tagged_response'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/net-imap-0.2.3/lib/net/imap.rb:1299:in `block in send_command'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/net-imap-0.2.3/lib/net/imap.rb:1281:in `send_command'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/net-imap-0.2.3/lib/net/imap.rb:365:in `starttls'
/home/redmine/redmine/lib/redmine/imap.rb:34:in `check'
/home/redmine/redmine/lib/tasks/email.rake:121:in `block (4 levels) in <top (required)>'
/home/redmine/redmine/app/models/mailer.rb:648:in `with_synched_deliveries'
/home/redmine/redmine/lib/tasks/email.rake:120:in `block (3 levels) in <top (required)>'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
Tasks: TOP => redmine:email:receive_imap
(See full trace by running task with --trace)

My env:

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal

Docker version 24.0.4, build 3713ee1

Docker Compose version v2.20.0

My docker-compose.yml file:

version: '2'

services:
  mysql:
    image: sameersbn/mysql:5.7.22-1
    environment:
      - DB_USER=redmine
      - DB_PASS=XXXXXXXXX
      - DB_NAME=redmine_production
    volumes:
      - /srv/docker/redmine/mysql:/var/lib/mysql

  redmine:
    build: ./
    image: sameersbn/redmine:5.0.5
    depends_on:
      - mysql
    environment:
      - DB_ADAPTER=mysql2
      - DB_HOST=mysql
      - DB_PORT=3306
      - DB_USER=redmine
      - DB_PASS=XXXXXXXXX
      - DB_NAME=redmine_production
      - DB_SSL_MODE=preferred

      - REDMINE_PORT=10083
      - REDMINE_HTTPS=false

      - REDMINE_BACKUP_SCHEDULE=daily
      - REDMINE_BACKUP_EXPIRY=7
      - REDMINE_BACKUP_TIME=04:00

      - SMTP_ENABLED=true
      - SMTP_METHOD=smtp
      - SMTP_DOMAIN=XXXXXXXXX.XXX.XX
      - SMTP_HOST=smtp.office365.com
      - SMTP_PORT=587
      - SMTP_USER=redmine@XXXXXXXXX.XXX.XX
      - SMTP_PASS=XXXXXXXXX
      - SMTP_STARTTLS=true
      - SMTP_AUTHENTICATION=:login

      - IMAP_ENABLED=true
      - IMAP_HOST=outlook.office365.com
      - IMAP_PORT=993
      - IMAP_USER=redmine@XXXXXXXXX.XXX.XX
      - IMAP_PASS=XXXXXXXXX
      - IMAP_SSL=true
      - IMAP_STARTTLS=true
      - IMAP_INTERVAL=1
      - IMAP_FOLDER=INBOX
    ports:
      - "10083:80"
    volumes:
      - /srv/docker/redmine/redmine_mysql:/home/redmine/data
      - /srv/docker/redmine/redmine-logs:/var/log/redmine

SMTP are working good.

When i run rake --trace i got this:

root@279afaa96aab:/home/redmine/redmine# rake --trace RAILS_ENV=production redmine:email:receive_imap host=outlook.office365.com username=redmine@XXXXXXXXX.XXX.XX password=XXXXXXXXX
rake aborted!
Gem::LoadError: You have already activated rake 13.0.1, but your Gemfile requires rake 13.0.6. Prepending `bundle exec` to your command may solve this.
/var/lib/gems/2.7.0/gems/bundler-2.4.8/lib/bundler/runtime.rb:304:in `check_for_activated_spec!'
/var/lib/gems/2.7.0/gems/bundler-2.4.8/lib/bundler/runtime.rb:25:in `block in setup'
/var/lib/gems/2.7.0/gems/bundler-2.4.8/lib/bundler/spec_set.rb:161:in `each'
/var/lib/gems/2.7.0/gems/bundler-2.4.8/lib/bundler/spec_set.rb:161:in `each'
/var/lib/gems/2.7.0/gems/bundler-2.4.8/lib/bundler/runtime.rb:24:in `map'
/var/lib/gems/2.7.0/gems/bundler-2.4.8/lib/bundler/runtime.rb:24:in `setup'
/var/lib/gems/2.7.0/gems/bundler-2.4.8/lib/bundler.rb:170:in `setup'
/var/lib/gems/2.7.0/gems/bundler-2.4.8/lib/bundler/setup.rb:10:in `block in <top (required)>'
/var/lib/gems/2.7.0/gems/bundler-2.4.8/lib/bundler/ui/shell.rb:159:in `with_level'
/var/lib/gems/2.7.0/gems/bundler-2.4.8/lib/bundler/ui/shell.rb:111:in `silence'
/var/lib/gems/2.7.0/gems/bundler-2.4.8/lib/bundler/setup.rb:10:in `<top (required)>'
/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
/home/redmine/redmine/config/boot.rb:6:in `<top (required)>'
/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
/home/redmine/redmine/config/application.rb:3:in `<top (required)>'
/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
/home/redmine/redmine/Rakefile:5:in `<top (required)>'
/usr/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/rake_module.rb:29:in `load'
/usr/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/rake_module.rb:29:in `load_rakefile'
/usr/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:703:in `raw_load_rakefile'
/usr/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:104:in `block in load_rakefile'
/usr/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:186:in `standard_exception_handling'
/usr/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:103:in `load_rakefile'
/usr/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:82:in `block in run'
/usr/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:186:in `standard_exception_handling'
/usr/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:80:in `run'
/usr/lib/ruby/gems/2.7.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/usr/bin/rake:23:in `load'
/usr/bin/rake:23:in `<main>'

Running with 'bundle exec':

root@279afaa96aab:/home/redmine/redmine# bundle exec rake --trace RAILS_ENV=production redmine:email:receive_imap host=outlook.office365.com username=redmine@XXXXXXXXX.XXX.XX password=XXXXXXXXX
** Invoke redmine:email:receive_imap (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:email:receive_imap
rake aborted!
Net::IMAP::BadResponseError: Command received in Invalid state.
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/net-imap-0.2.3/lib/net/imap.rb:1247:in `get_tagged_response'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/net-imap-0.2.3/lib/net/imap.rb:1299:in `block in send_command'
/usr/lib/ruby/2.7.0/monitor.rb:202:in `synchronize'
/usr/lib/ruby/2.7.0/monitor.rb:202:in `mon_synchronize'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/net-imap-0.2.3/lib/net/imap.rb:1281:in `send_command'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/net-imap-0.2.3/lib/net/imap.rb:422:in `login'
/home/redmine/redmine/lib/redmine/imap.rb:36:in `check'
/home/redmine/redmine/lib/tasks/email.rake:121:in `block (4 levels) in <top (required)>'
/home/redmine/redmine/app/models/mailer.rb:648:in `with_synched_deliveries'
/home/redmine/redmine/lib/tasks/email.rake:120:in `block (3 levels) in <top (required)>'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:83:in `block in run'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
/home/redmine/data/tmp/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/home/redmine/redmine/vendor/bundle/ruby/2.7.0/bin/rake:23:in `load'
/home/redmine/redmine/vendor/bundle/ruby/2.7.0/bin/rake:23:in `<main>'
Tasks: TOP => redmine:email:receive_imap

Does anyone have ideia how to solve it?

Tks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant