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

Fixes sys:cron:schedule 'area code is not set' exception. #277

Merged
merged 2 commits into from Mar 17, 2017

Conversation

Projects
None yet
3 participants
@hostep
Contributor

hostep commented Mar 12, 2017

Magerun pull-request check-list:

  • Pull request against develop branch (if not, just close and create a new one against it)
  • README.md reflects changes (if any)

After upgrading magerun2 from version 1.3.2 to 1.3.3, and running the command:
sys:cron:schedule some-cronjob, we get the error:

  [Magento\Framework\Exception\SessionException]
  Area code not set: Area code must be set before starting a session.

  [Magento\Framework\Exception\LocalizedException]
  Area code is not set

This problem was recently introduced by 64063ae & a50f3b7

Fixing it by using the same workaround as in 64063ae

Not sure if all the code is needed though, only the first line already solves the problem, not sure if the other 3 lines are actually necessary?

Thanks!

hostep referenced this pull request Mar 12, 2017

Configure objected manager for crontab area, dbugging #245
In Magento 2 it does not even run within emulation, but this should make
not much of a difference.

There are some $_SERVER variables left, this is the object manager
configuration only.

To be tested.
@cmuench

This comment has been minimized.

Show comment
Hide comment
@cmuench

cmuench Mar 13, 2017

Member

@hostep The build is currently failing. Please resend the PR with the correct "use" for the area class.

Member

cmuench commented Mar 13, 2017

@hostep The build is currently failing. Please resend the PR with the correct "use" for the area class.

@hostep

This comment has been minimized.

Show comment
Hide comment
@hostep

hostep Mar 13, 2017

Contributor

@cmuench: thanks for the heads up!

I tested it yesterday with the use line, but then forgot to put it in the PR, stupid me 😄

Let's hope it goes through the tests correctly this time.

Contributor

hostep commented Mar 13, 2017

@cmuench: thanks for the heads up!

I tested it yesterday with the use line, but then forgot to put it in the PR, stupid me 😄

Let's hope it goes through the tests correctly this time.

@cmuench cmuench merged commit 772a5ee into netz98:develop Mar 17, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@cmuench

This comment has been minimized.

Show comment
Hide comment
@cmuench

cmuench Mar 17, 2017

Member

Thanks

Member

cmuench commented Mar 17, 2017

Thanks

@tkn98

This comment has been minimized.

Show comment
Hide comment
@tkn98

tkn98 Mar 27, 2017

Contributor

@hostep: Thanks for the PR. Have you seen in #245 that some users report it not-working for them. So my question would be if it solved your issue.

Contributor

tkn98 commented Mar 27, 2017

@hostep: Thanks for the PR. Have you seen in #245 that some users report it not-working for them. So my question would be if it solved your issue.

@hostep

This comment has been minimized.

Show comment
Hide comment
@hostep

hostep Mar 27, 2017

Contributor

@tkn98: this PR fixed our problem yes :)

I copied some changes from 64063ae and that seems to solve the problem.

I'm still not quite convinced that all the code is necessary, adding only the line

$this->state->setAreaCode(Area::AREA_CRONTAB);

fixed the issue already, but to be consistent, I copied the other 3 lines as well.

As for #245, that was for the sys:cron:run command. In this PR, I'm talking about the sys:cron:schedule command.

Contributor

hostep commented Mar 27, 2017

@tkn98: this PR fixed our problem yes :)

I copied some changes from 64063ae and that seems to solve the problem.

I'm still not quite convinced that all the code is necessary, adding only the line

$this->state->setAreaCode(Area::AREA_CRONTAB);

fixed the issue already, but to be consistent, I copied the other 3 lines as well.

As for #245, that was for the sys:cron:run command. In this PR, I'm talking about the sys:cron:schedule command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment