Page MenuHomePhabricator

Campaigns cannot be created
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Go to the tool: https://isa.toolforge.org/
  • Login
  • From the menu, click on "Create new"
  • Fill the form and then validate
  • Then you can see that an error message (in green) is displayed, and the campaign is not created.

See screenshot:

Capture d’écran 2023-08-12 à 19.54.34.png (900×2 px, 155 KB)

What happens?:
When users try to create a new campaign, an error message is displayed and the campaign is not created.

What should have happened instead?:
Users should be able to create new campaigns on ISA tool

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):
Browser: Chrome. Noted the same behavior on Firefox as well.

Event Timeline

I modified an earlier test campaign so that the Wikimania campaign could be created.
And in doing so... I realized that there is a « tight » limitation in terms of number of characters allowed for the name of the campaign. It used to be much longer. The number of characters allowed now is too short.
And the name proposed by Mahuton is longer than the authorized length. This might suggest that the campaign creation was rejected because of the length of the name.
This is just a suggestion. I did not have the opportunity to try creating a new campaign with a short and a long name; So it could be related, or unrelated.

I think I found the error in the log (see below). Looks like the issue is that ISA doesn't think there is a logged in user. We've had some similar issues in the past e.g. T304090.

Exception when committing to database.
Campaign info updated successfully!
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/flask/app
.py", line 2213, in __call__
    return self.wsgi_app(environ, start_response)
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/flask/app
.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/flask/app
.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/flask/app
.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/data/project/isa/www/python/src/isa/campaigns/routes.py", line 217, in 
CreateCampaign
    if not commit_changes_to_db():
  File "/data/project/isa/www/python/src/isa/main/utils.py", line 18, in commit_
changes_to_db
    traceback.print_stack()
Traceback (most recent call last):
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchem
y/engine/base.py", line 1910, in _execute_context
    self.dialect.do_execute(
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchem
y/engine/default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/c
ursors.py", line 153, in execute
    result = self._query(query)
             ^^^^^^^^^^^^^^^^^^
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/c
ursors.py", line 322, in _query
    conn.query(q)
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/c
onnections.py", line 558, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/c
onnections.py", line 822, in _read_query_result
    result.read()
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/c
onnections.py", line 1200, in read
    first_packet = self.connection._read_packet()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/connections.py", line 772, in _read_packet
    packet.raise_for_error()
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/e
rr.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1048, "Column 'manager_id' cannot be null")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/data/project/isa/www/python/src/isa/main/utils.py", line 13, in commit_changes_to_db
    db.session.commit()
  File "<string>", line 2, in commit
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1454, in commit
    self._transaction.commit(_to_root=self.future)
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 832, in commit
    self._prepare_impl()
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 811, in _prepare_impl
    self.session.flush()
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 3449, in flush
    self._flush(objects)
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 3588, in _flush
    with util.safe_reraise():
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
    compat.raise_(
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 3549, in _flush
    flush_context.execute()
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/orm/unitofwork.py", line 456, in execute
    rec.execute(self)
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/orm/unitofwork.py", line 630, in execute
    util.preloaded.orm_persistence.save_obj(
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/orm/persistence.py", line 245, in save_obj
    _emit_insert_statements(
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/orm/persistence.py", line 1238, in _emit_insert_statements
    result = connection._execute_20(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1710, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
    return connection._execute_clauseelement(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1577, in _execute_clauseelement
    ret = self._execute_context(
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1953, in _execute_context
    self._handle_dbapi_exception(
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2134, in _handle_dbapi_exception
    util.raise_(
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1910, in _execute_context
    self.dialect.do_execute(
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/cursors.py", line 153, in execute
    result = self._query(query)
             ^^^^^^^^^^^^^^^^^^
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/connections.py", line 558, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/connections.py", line 822, in _read_query_result
    result.read()
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/connections.py", line 1200, in read
    first_packet = self.connection._read_packet()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/connections.py", line 772, in _read_packet
    packet.raise_for_error()
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "/data/project/isa/www/python/venv/lib/python3.11/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
sqlalchemy.exc.IntegrityError: (pymysql.err.IntegrityError) (1048, "Column 'manager_id' cannot be null")
[SQL: INSERT INTO campaign (campaign_name, campaign_images, update_status, campaign_contributions, campaign_participants, campaign_image, start_date, campaign_manager, manager_id, end_date, status, short_description, long_description, categories, creation_date, campaign_type, depicts_metadata, captions_metadata) VALUES (%(campaign_name)s, %(campaign_images)s, %(update_status)s, %(campaign_contributions)s, %(campaign_participants)s, %(campaign_image)s, %(start_date)s, %(campaign_manager)s, %(manager_id)s, %(end_date)s, %(status)s, %(short_description)s, %(long_description)s, %(categories)s, %(creation_date)s, %(campaign_type)s, %(depicts_metadata)s, %(captions_metadata)s)]
[parameters: {'campaign_name': 'Wikimania Editing Ch', 'campaign_images': 0, 'update_status': 0, 'campaign_contributions': 0, 'campaign_participants': 0, 'campaign_image': '', 'start_date': datetime.datetime(2023, 8, 15, 0, 0), 'campaign_manager': None, 'manager_id': None, 'end_date': datetime.datetime(2023, 8, 19, 0, 0), 'status': 1, 'short_description': 'Wikimania Editing Challenge', 'long_description': '', 'categories': '[{"name":"Wiki Loves Africa 2023","depth":"0"}]', 'creation_date': datetime.date(2023, 8, 12), 'campaign_type': 0, 'depicts_metadata': 1, 'captions_metadata': 0}]
(Background on this error at: https://sqlalche.me/e/14/gkpj)

@Mh-3110, I had a look in ISA's database and I couldn't find your username (the one in the screenshot). As a workaround, go to the main page (https://isa.toolforge.org) log out and log in again. It's important that you're on the main page when you log in. This should properly add a user.

My coworker got the same result when creating a new campaign. Meanwhile I'm using my own account, and I can create a new campaign (I'm teaching her how to create a new campaign).

My suspicion is maybe because she created the account recently (her work account). Then she tried using another account, her personal account, that she never used since 2017 (only 3 edits), with the same result: she can't create a new campaign.

And in doing so... I realized that there is a « tight » limitation in terms of number of characters allowed for the name of the campaign. It used to be much longer. The number of characters allowed now is too short.

https://phabricator.wikimedia.org/T345142

If possible, please enable multiple campaign manager, so that I can create the campaign, and then handover to my coworker.
https://phabricator.wikimedia.org/T325805

Hi @Bennylin, @Sebastian_Berlin-WMSE thanks for taking a look at this. I ran the tool in my local yesterday and what I noticed is that, for some reason, the manager_id attribute of the campaign model is not populated when the campaign is submitted. That raised the error and the campaign is not saved.
Note: in my local env, I'm using the development ISA_DEV user.

@Sebastian_Berlin-WMSE, have just made a new test in prod. Same error. Are you able to share more production logs? I need to double-check.
Also, can anyone else test creating new campaign on their side?
Thanks