<buttonid="sidebar-toggle"class="icon-button"type="button"title="Toggle Table of Contents"aria-label="Toggle Table of Contents"aria-controls="sidebar">
<ahref="https://github.com/matrix-org/synapse/edit/develop/docs/upgrade.md"title="Suggest an edit"aria-label="Suggest an edit">
<iid="git-edit-button"class="fa fa-edit"></i>
</a>
</div>
</div>
<divid="search-wrapper"class="hidden">
<formid="searchbar-outer"class="searchbar-outer">
<inputtype="search"id="searchbar"name="searchbar"placeholder="Search this book ..."aria-controls="searchresults-outer"aria-describedby="searchresults-header">
<h1id="upgrading-to-v1620"><aclass="header"href="#upgrading-to-v1620">Upgrading to v1.62.0</a></h1>
<h2id="new-signatures-for-spam-checker-callbacks"><aclass="header"href="#new-signatures-for-spam-checker-callbacks">New signatures for spam checker callbacks</a></h2>
<p>As a followup to changes in v1.60.0, the following spam-checker callbacks have changed signature:</p>
<ul>
<li><code>user_may_join_room</code></li>
<li><code>user_may_invite</code></li>
<li><code>user_may_send_3pid_invite</code></li>
<li><code>user_may_create_room</code></li>
<li><code>user_may_create_room_alias</code></li>
<li><code>user_may_publish_room</code></li>
<li><code>check_media_file_for_spam</code></li>
</ul>
<p>For each of these methods, the previous callback signature has been deprecated.</p>
<p>Whereas callbacks used to return <code>bool</code>, they should now return <code>Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes"]</code>.</p>
<p>For instance, if your module implements <code>user_may_join_room</code> as follows:</p>
# Request is spam, mark it as forbidden (you may use some more precise error
# code if it is useful).
return synapse.module_api.errors.Codes.FORBIDDEN
# Request is not spam, mark it as such.
return synapse.module_api.NOT_SPAM
</code></pre>
<h1id="upgrading-to-v1610"><aclass="header"href="#upgrading-to-v1610">Upgrading to v1.61.0</a></h1>
<h2id="removal-of-deprecated-communitygroups"><aclass="header"href="#removal-of-deprecated-communitygroups">Removal of deprecated community/groups</a></h2>
<p>This release of Synapse will remove deprecated community/groups from codebase.</p>
<h1id="upgrading-to-v1600"><aclass="header"href="#upgrading-to-v1600">Upgrading to v1.60.0</a></h1>
<h2id="adding-a-new-unique-index-to-state_group_edges-could-fail-if-your-database-is-corrupted"><aclass="header"href="#adding-a-new-unique-index-to-state_group_edges-could-fail-if-your-database-is-corrupted">Adding a new unique index to <code>state_group_edges</code> could fail if your database is corrupted</a></h2>
<p>This release of Synapse will add a unique index to the <code>state_group_edges</code> table, in order
to prevent accidentally introducing duplicate information (for example, because a database
backup was restored multiple times).</p>
<p>Duplicate rows being present in this table could cause drastic performance problems; see
<ahref="https://github.com/matrix-org/synapse/issues/11779">issue 11779</a> for more details.</p>
<p>If your Synapse database already has had duplicate rows introduced into this table,
this could fail, with either of these errors:</p>
<p><strong>On Postgres:</strong></p>
<pre><code>synapse.storage.background_updates - 623 - INFO - background_updates-0 - Adding index state_group_edges_unique_idx to state_group_edges
<p>At the command-line, use <code>sqlite3 path/to/your-homeserver-database.db</code>:</p>
<pre><codeclass="language-sql">BEGIN;
DELETE FROM state_group_edges WHERE (rowid, state_group, prev_state_group) IN (
SELECT row_id, state_group, prev_state_group
FROM (
SELECT
rowid AS row_id,
MIN(rowid) OVER (PARTITION BY state_group, prev_state_group) AS min_row_id,
state_group,
prev_state_group
FROM state_group_edges
)
WHERE row_id <> min_row_id
);
COMMIT;
</code></pre>
<h3id="for-more-details"><aclass="header"href="#for-more-details">For more details</a></h3>
<p><ahref="https://github.com/matrix-org/synapse/issues/11779#issuecomment-1131545970">This comment on issue 11779</a>
has queries that can be used to check a database for this problem in advance.</p>
</details>
<h2id="new-signature-for-the-spam-checker-callback-check_event_for_spam"><aclass="header"href="#new-signature-for-the-spam-checker-callback-check_event_for_spam">New signature for the spam checker callback <code>check_event_for_spam</code></a></h2>
<p>The previous signature has been deprecated.</p>
<p>Whereas <code>check_event_for_spam</code> callbacks used to return <code>Union[str, bool]</code>, they should now return <code>Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes"]</code>.</p>
<p>This is part of an ongoing refactoring of the SpamChecker API to make it less ambiguous and more powerful.</p>
<p>If your module implements <code>check_event_for_spam</code> as follows:</p>
# Event is spam, mark it as forbidden (you may use some more precise error
# code if it is useful).
return synapse.module_api.errors.Codes.FORBIDDEN
# Event is not spam, mark it as such.
return synapse.module_api.NOT_SPAM
</code></pre>
<h1id="upgrading-to-v1590"><aclass="header"href="#upgrading-to-v1590">Upgrading to v1.59.0</a></h1>
<h2id="device-name-lookup-over-federation-has-been-disabled-by-default"><aclass="header"href="#device-name-lookup-over-federation-has-been-disabled-by-default">Device name lookup over federation has been disabled by default</a></h2>
<p>The names of user devices are no longer visible to users on other homeservers by default.
Device IDs are unaffected, as these are necessary to facilitate end-to-end encryption.</p>
homeserver config option to <code>true</code>.</p>
<h2id="deprecation-of-the-synapseappappservice-and-synapseappuser_dir-worker-application-types"><aclass="header"href="#deprecation-of-the-synapseappappservice-and-synapseappuser_dir-worker-application-types">Deprecation of the <code>synapse.app.appservice</code> and <code>synapse.app.user_dir</code> worker application types</a></h2>
<p>The <code>synapse.app.appservice</code> worker application type allowed you to configure a
single worker to use to notify application services of new events, as long
as this functionality was disabled on the main process with <code>notify_appservices: False</code>.
Further, the <code>synapse.app.user_dir</code> worker application type allowed you to configure
a single worker to be responsible for updating the user directory, as long as this
was disabled on the main process with <code>update_user_directory: False</code>.</p>
<p>To unify Synapse's worker types, the <code>synapse.app.appservice</code> worker application
type and the <code>notify_appservices</code> configuration option have been deprecated.
The <code>synapse.app.user_dir</code> worker application type and <code>update_user_directory</code>
configuration option have also been deprecated.</p>
<p>To get the same functionality as was provided by the deprecated options, it's now recommended that the <code>synapse.app.generic_worker</code>
worker application type is used and that the <code>notify_appservices_from_worker</code> and/or
<code>update_user_directory_from_worker</code> options are set to the name of a worker.</p>
<p>For the time being, the old options can be used alongside the new options to make
it easier to transition between the two configurations, however please note that:</p>
<ul>
<li>the options must not contradict each other (otherwise Synapse won't start); and</li>
<li>the <code>notify_appservices</code> and <code>update_user_directory</code> options will be removed in a future release of Synapse.</li>
</ul>
<p>Please see the <ahref="workers.html#notifying-application-services"><em>Notifying Application Services</em></a> and
<ahref="workers.html#updating-the-user-directory"><em>Updating the User Directory</em></a> sections of the worker
documentation for more information.</p>
<h1id="upgrading-to-v1580"><aclass="header"href="#upgrading-to-v1580">Upgrading to v1.58.0</a></h1>
<h2id="groupscommunities-feature-has-been-disabled-by-default"><aclass="header"href="#groupscommunities-feature-has-been-disabled-by-default">Groups/communities feature has been disabled by default</a></h2>
<p>The non-standard groups/communities feature in Synapse has been disabled by default
and will be removed in Synapse v1.61.0.</p>
<h1id="upgrading-to-v1570"><aclass="header"href="#upgrading-to-v1570">Upgrading to v1.57.0</a></h1>
<h2id="changes-to-database-schema-for-application-services"><aclass="header"href="#changes-to-database-schema-for-application-services">Changes to database schema for application services</a></h2>
<p>Synapse v1.57.0 includes a <ahref="https://github.com/matrix-org/synapse/pull/12209">change</a> to the
way transaction IDs are managed for application services. If your deployment uses a dedicated
worker for application service traffic, <strong>it must be stopped</strong> when the database is upgraded
(which normally happens when the main process is upgraded), to ensure the change is made safely
without any risk of reusing transaction IDs.</p>
<p>Deployments which do not use separate worker processes can be upgraded as normal. Similarly,
deployments where no application services are in use can be upgraded as normal.</p>
<details>
<summary><b>Recovering from an incorrect upgrade</b></summary>
<p>If the database schema is upgraded <em>without</em> stopping the worker responsible
for AS traffic, then the following error may be given when attempting to start
<p>This error may also be seen if Synapse is <em>downgraded</em> to an earlier version,
and then upgraded again to v1.57.0 or later.</p>
<p>In either case:</p>
<ol>
<li>Ensure that the worker responsible for AS traffic is stopped.</li>
<li>Run the SQL command given in the error message via <code>psql</code>.</li>
</ol>
<p>Synapse should then start correctly.</p>
</details>
<h1id="upgrading-to-v1560"><aclass="header"href="#upgrading-to-v1560">Upgrading to v1.56.0</a></h1>
<h2id="open-registration-without-verification-is-now-disabled-by-default"><aclass="header"href="#open-registration-without-verification-is-now-disabled-by-default">Open registration without verification is now disabled by default</a></h2>
<p>Synapse will refuse to start if registration is enabled without email, captcha, or token-based verification unless the new config
flag <code>enable_registration_without_verification</code> is set to "true".</p>
<h2id="groupscommunities-feature-has-been-deprecated"><aclass="header"href="#groupscommunities-feature-has-been-deprecated">Groups/communities feature has been deprecated</a></h2>
<p>The non-standard groups/communities feature in Synapse has been deprecated and will
be disabled by default in Synapse v1.58.0.</p>
<p>You can test disabling it by adding the following to your homeserver configuration:</p>
<h2id="change-in-behaviour-for-postgresql-databases-with-unsafe-locale"><aclass="header"href="#change-in-behaviour-for-postgresql-databases-with-unsafe-locale">Change in behaviour for PostgreSQL databases with unsafe locale</a></h2>
<p>Synapse now refuses to start when using PostgreSQL with non-<code>C</code> values for <code>COLLATE</code> and
<code>CTYPE</code> unless the config flag <code>allow_unsafe_locale</code>, found in the database section of
the configuration file, is set to <code>true</code>. See the <ahref="https://matrix-org.github.io/synapse/latest/postgres.html#fixing-incorrect-collate-or-ctype">PostgreSQL documentation</a>
for more information and instructions on how to fix a database with incorrect values.</p>
<h1id="upgrading-to-v1550"><aclass="header"href="#upgrading-to-v1550">Upgrading to v1.55.0</a></h1>
<h2id="synctl-script-has-been-moved"><aclass="header"href="#synctl-script-has-been-moved"><code>synctl</code> script has been moved</a></h2>
<p>The <code>synctl</code> script
<ahref="https://github.com/matrix-org/synapse/pull/12140">has been made</a> an
<li>When installing from a wheel, sdist, or PyPI, a <code>synctl</code> executable is added
to your Python installation's <code>bin</code>. This should be on your <code>PATH</code>
automatically, though you might need to activate a virtual environment
depending on how you installed Synapse.</li>
</ul>
<h2id="compatibility-dropped-for-mjolnir-131-and-earlier"><aclass="header"href="#compatibility-dropped-for-mjolnir-131-and-earlier">Compatibility dropped for Mjolnir 1.3.1 and earlier</a></h2>
<p>Synapse v1.55.0 drops support for Mjolnir 1.3.1 and earlier.
If you use the Mjolnir module to moderate your homeserver,
please upgrade Mjolnir to version 1.3.2 or later before upgrading Synapse.</p>
<h1id="upgrading-to-v1540"><aclass="header"href="#upgrading-to-v1540">Upgrading to v1.54.0</a></h1>
<h1id="upgrading-to-v1530"><aclass="header"href="#upgrading-to-v1530">Upgrading to v1.53.0</a></h1>
<h2id="dropping-support-for-webclient-listeners-and-non-https-web_client_location"><aclass="header"href="#dropping-support-for-webclient-listeners-and-non-https-web_client_location">Dropping support for <code>webclient</code> listeners and non-HTTP(S) <code>web_client_location</code></a></h2>
<p>Per the deprecation notice in Synapse v1.51.0, listeners of type <code>webclient</code>
are no longer supported and configuring them is a now a configuration error.</p>
<p>Configuring a non-HTTP(S) <code>web_client_location</code> configuration is is now a
configuration error. Since the <code>webclient</code> listener is no longer supported, this
setting only applies to the root path <code>/</code> of Synapse's web server and no longer
the <code>/_matrix/client/</code> path.</p>
<h2id="stablisation-of-msc3231"><aclass="header"href="#stablisation-of-msc3231">Stablisation of MSC3231</a></h2>
<p>Please update any relevant reverse proxy or firewall configurations appropriately.</p>
<h2id="time-based-cache-expiry-is-now-enabled-by-default"><aclass="header"href="#time-based-cache-expiry-is-now-enabled-by-default">Time-based cache expiry is now enabled by default</a></h2>
<p>Formerly, entries in the cache were not evicted regardless of whether they were accessed after storing.
This behavior has now changed. By default entries in the cache are now evicted after 30m of not being accessed.
To change the default behavior, go to the <code>caches</code> section of the config and change the <code>expire_caches</code> and
<code>cache_entry_ttl</code> flags as necessary. Please note that these flags replace the <code>expiry_time</code> flag in the config.
The <code>expiry_time</code> flag will still continue to work, but it has been deprecated and will be removed in the future.</p>
<h2id="deprecation-of-capability-orgmatrixmsc3283"><aclass="header"href="#deprecation-of-capability-orgmatrixmsc3283">Deprecation of <code>capability</code><code>org.matrix.msc3283.*</code></a></h2>
<p>The <code>capabilities</code> of MSC3283 from the REST API <code>/_matrix/client/r0/capabilities</code>
<p>are deprecated and scheduled to be removed in Synapse v1.54.0.</p>
<p>The new <code>capabilities</code></p>
<ul>
<li><code>m.set_displayname</code>,</li>
<li><code>m.set_avatar_url</code> and</li>
<li><code>m.3pid_changes</code></li>
</ul>
<p>are now active by default.</p>
<h2id="removal-of-user_may_create_room_with_invites"><aclass="header"href="#removal-of-user_may_create_room_with_invites">Removal of <code>user_may_create_room_with_invites</code></a></h2>
<p>As announced with the release of <ahref="#deprecation-of-the-user_may_create_room_with_invites-module-callback">Synapse 1.47.0</a>,
the deprecated <code>user_may_create_room_with_invites</code> module callback has been removed.</p>
<p>Modules relying on it can instead implement <ahref="https://matrix-org.github.io/synapse/latest/modules/spam_checker_callbacks.html#user_may_invite"><code>user_may_invite</code></a>
and use the <ahref="https://github.com/matrix-org/synapse/blob/872f23b95fa980a61b0866c1475e84491991fa20/synapse/module_api/__init__.py#L869-L876"><code>get_room_state</code></a>
module API to infer whether the invite is happening while creating a room (see <ahref="https://github.com/matrix-org/synapse-domain-rule-checker/blob/e7d092dd9f2a7f844928771dbfd9fd24c2332e48/synapse_domain_rule_checker/__init__.py#L56-L89">this function</a>
as an example). Alternately, modules can also implement <ahref="https://matrix-org.github.io/synapse/latest/modules/third_party_rules_callbacks.html#on_create_room"><code>on_create_room</code></a>.</p>
<h1id="upgrading-to-v1520"><aclass="header"href="#upgrading-to-v1520">Upgrading to v1.52.0</a></h1>
<p>Note that <ahref="https://github.com/twisted/twisted/releases/tag/twisted-22.1.0">Twisted 22.1.0</a>
has recently been released, which fixes a <ahref="https://github.com/twisted/twisted/security/advisories/GHSA-92x2-jw7w-xvvx">security issue</a>
within the Twisted library. We do not believe Synapse is affected by this vulnerability,
though we advise server administrators who installed Synapse via pip to upgrade Twisted
with <code>pip install --upgrade Twisted treq</code> as a matter of good practice. The Docker image
<code>matrixdotorg/synapse</code> and the Debian packages from <code>packages.matrix.org</code> are using the
updated library.</p>
<h1id="upgrading-to-v1510"><aclass="header"href="#upgrading-to-v1510">Upgrading to v1.51.0</a></h1>
<h2id="deprecation-of-webclient-listeners-and-non-https-web_client_location"><aclass="header"href="#deprecation-of-webclient-listeners-and-non-https-web_client_location">Deprecation of <code>webclient</code> listeners and non-HTTP(S) <code>web_client_location</code></a></h2>
<p>Listeners of type <code>webclient</code> are deprecated and scheduled to be removed in
Synapse v1.53.0.</p>
<p>Similarly, a non-HTTP(S) <code>web_client_location</code> configuration is deprecated and
will become a configuration error in Synapse v1.53.0.</p>
<h1id="upgrading-to-v1500"><aclass="header"href="#upgrading-to-v1500">Upgrading to v1.50.0</a></h1>
<h2id="dropping-support-for-old-python-and-postgres-versions"><aclass="header"href="#dropping-support-for-old-python-and-postgres-versions">Dropping support for old Python and Postgres versions</a></h2>
<p>In line with our <ahref="deprecation_policy.html">deprecation policy</a>,
we've dropped support for Python 3.6 and PostgreSQL 9.6, as they are no
longer supported upstream.</p>
<p>This release of Synapse requires Python 3.7+ and PostgreSQL 10+.</p>
<h1id="upgrading-to-v1470"><aclass="header"href="#upgrading-to-v1470">Upgrading to v1.47.0</a></h1>
<h2id="removal-of-old-room-admin-api"><aclass="header"href="#removal-of-old-room-admin-api">Removal of old Room Admin API</a></h2>
<p>The following admin APIs were deprecated in <ahref="https://github.com/matrix-org/synapse/blob/v1.34.0/CHANGES.md#deprecations-and-removals">Synapse 1.34</a>
(released on 2021-05-17) and have now been removed:</p>
<h2id="deprecation-of-the-user_may_create_room_with_invites-module-callback"><aclass="header"href="#deprecation-of-the-user_may_create_room_with_invites-module-callback">Deprecation of the <code>user_may_create_room_with_invites</code> module callback</a></h2>
<p>The <code>user_may_create_room_with_invites</code> is deprecated and will be removed in a future
version of Synapse. Modules implementing this callback can instead implement
and use the <ahref="https://github.com/matrix-org/synapse/blob/872f23b95fa980a61b0866c1475e84491991fa20/synapse/module_api/__init__.py#L869-L876"><code>get_room_state</code></a>
module API method to infer whether the invite is happening in the context of creating a
room.</p>
<p>We plan to remove this callback in January 2022.</p>
<h1id="upgrading-to-v1450"><aclass="header"href="#upgrading-to-v1450">Upgrading to v1.45.0</a></h1>
<h2id="changes-required-to-media-storage-provider-modules-when-reading-from-the-synapse-configuration-object"><aclass="header"href="#changes-required-to-media-storage-provider-modules-when-reading-from-the-synapse-configuration-object">Changes required to media storage provider modules when reading from the Synapse configuration object</a></h2>
<p>Media storage provider modules that read from the Synapse configuration object (i.e. that
read the value of <code>hs.config.[...]</code>) now need to specify the configuration section they're
reading from. This means that if a module reads the value of e.g. <code>hs.config.media_store_path</code>,
it needs to replace it with <code>hs.config.media.media_store_path</code>.</p>
<h1id="upgrading-to-v1440"><aclass="header"href="#upgrading-to-v1440">Upgrading to v1.44.0</a></h1>
<h2id="the-url-preview-cache-is-no-longer-mirrored-to-storage-providers"><aclass="header"href="#the-url-preview-cache-is-no-longer-mirrored-to-storage-providers">The URL preview cache is no longer mirrored to storage providers</a></h2>
<p>The <code>url_cache/</code> and <code>url_cache_thumbnails/</code> directories in the media store are
no longer mirrored to storage providers. These two directories can be safely
deleted from any configured storage providers to reclaim space.</p>
<h1id="upgrading-to-v1430"><aclass="header"href="#upgrading-to-v1430">Upgrading to v1.43.0</a></h1>
<h2id="the-spaces-summary-apis-can-now-be-handled-by-workers"><aclass="header"href="#the-spaces-summary-apis-can-now-be-handled-by-workers">The spaces summary APIs can now be handled by workers</a></h2>
<h2id="user-interactive-authentication-fallback-templates-can-now-display-errors"><aclass="header"href="#user-interactive-authentication-fallback-templates-can-now-display-errors">User-interactive authentication fallback templates can now display errors</a></h2>
<p>This may affect you if you make use of custom HTML templates for the
<ahref="../synapse/res/templates/recaptcha.html">reCAPTCHA</a> or
<p>The template is now provided an <code>error</code> variable if the authentication
process failed. See the default templates linked above for an example.</p>
<h2id="removal-of-out-of-date-email-pushers"><aclass="header"href="#removal-of-out-of-date-email-pushers">Removal of out-of-date email pushers</a></h2>
<p>Users will stop receiving message updates via email for addresses that were
once, but not still, linked to their account.</p>
<h1id="upgrading-to-v1410"><aclass="header"href="#upgrading-to-v1410">Upgrading to v1.41.0</a></h1>
<h2id="add-support-for-routing-outbound-http-requests-via-a-proxy-for-federation"><aclass="header"href="#add-support-for-routing-outbound-http-requests-via-a-proxy-for-federation">Add support for routing outbound HTTP requests via a proxy for federation</a></h2>
<p>Since Synapse 1.6.0 (2019-11-26) you can set a proxy for outbound HTTP requests via
http_proxy/https_proxy environment variables. This proxy was set for:</p>
<ul>
<li>push</li>
<li>url previews</li>
<li>phone-home stats</li>
<li>recaptcha validation</li>
<li>CAS auth validation</li>
<li>OpenID Connect</li>
<li>Federation (checking public key revocation)</li>
</ul>
<p>In this version we have added support for outbound requests for:</p>
<ul>
<li>Outbound federation</li>
<li>Downloading remote media</li>
<li>Fetching public keys of other servers</li>
</ul>
<p>These requests use the same proxy configuration. If you have a proxy configuration we
recommend to verify the configuration. It may be necessary to adjust the <code>no_proxy</code>
environment variable.</p>
<p>See <ahref="setup/forward_proxy.html">using a forward proxy with Synapse documentation</a> for
details.</p>
<h2id="deprecation-of-template_dir"><aclass="header"href="#deprecation-of-template_dir">Deprecation of <code>template_dir</code></a></h2>
<p>The <code>template_dir</code> settings in the <code>sso</code>, <code>account_validity</code> and <code>email</code> sections of the
configuration file are now deprecated. Server admins should use the new
<code>templates.custom_template_directory</code> setting in the configuration file and use one single
custom template directory for all aforementioned features. Template file names remain
unchanged. See <ahref="https://matrix-org.github.io/synapse/latest/templates.html">the related documentation</a>
for more information and examples.</p>
<p>We plan to remove support for these settings in October 2021.</p>
<h2id="_synapseadminv1usersuseridmedia-must-be-handled-by-media-workers"><aclass="header"href="#_synapseadminv1usersuseridmedia-must-be-handled-by-media-workers"><code>/_synapse/admin/v1/users/{userId}/media</code> must be handled by media workers</a></h2>
has been updated to reflect that calls to <code>/_synapse/admin/v1/users/{userId}/media</code>
must now be handled by media repository workers. This is due to the new <code>DELETE</code> method
of this endpoint modifying the media store.</p>
<h1id="upgrading-to-v1390"><aclass="header"href="#upgrading-to-v1390">Upgrading to v1.39.0</a></h1>
<h2id="deprecation-of-the-current-third-party-rules-module-interface"><aclass="header"href="#deprecation-of-the-current-third-party-rules-module-interface">Deprecation of the current third-party rules module interface</a></h2>
<p>The current third-party rules module interface is deprecated in favour of the new generic
modules system introduced in Synapse v1.37.0. Authors of third-party rules modules can refer
to <ahref="modules/porting_legacy_module.html">this documentation</a>
to update their modules. Synapse administrators can refer to <ahref="modules/index.html">this documentation</a>
to update their configuration once the modules they are using have been updated.</p>
<p>We plan to remove support for the current third-party rules interface in September 2021.</p>
<h1id="upgrading-to-v1380"><aclass="header"href="#upgrading-to-v1380">Upgrading to v1.38.0</a></h1>
<h2id="re-indexing-of-events-table-on-postgres-databases"><aclass="header"href="#re-indexing-of-events-table-on-postgres-databases">Re-indexing of <code>events</code> table on Postgres databases</a></h2>
<p>This release includes a database schema update which requires re-indexing one of
the larger tables in the database, <code>events</code>. This could result in increased
disk I/O for several hours or days after upgrading while the migration
completes. Furthermore, because we have to keep the old indexes until the new
indexes are ready, it could result in a significant, temporary, increase in
disk space.</p>
<p>To get a rough idea of the disk space required, check the current size of one
of the indexes. For example, from a <code>psql</code> shell, run the following sql:</p>
<p>On this server, it would be wise to ensure that at least 1152MB are free.</p>
<p>The additional disk space will be freed once the migration completes.</p>
<p>SQLite databases are unaffected by this change.</p>
<h1id="upgrading-to-v1370"><aclass="header"href="#upgrading-to-v1370">Upgrading to v1.37.0</a></h1>
<h2id="deprecation-of-the-current-spam-checker-interface"><aclass="header"href="#deprecation-of-the-current-spam-checker-interface">Deprecation of the current spam checker interface</a></h2>
<p>The current spam checker interface is deprecated in favour of a new generic modules system.
Authors of spam checker modules can refer to [this
documentation](modules/porting_legacy_module.md
to update their modules. Synapse administrators can refer to <ahref="modules/index.html">this
documentation</a>
to update their configuration once the modules they are using have been updated.</p>
<p>We plan to remove support for the current spam checker interface in August 2021.</p>
<p>More module interfaces will be ported over to this new generic system in future versions
of Synapse.</p>
<h1id="upgrading-to-v1340"><aclass="header"href="#upgrading-to-v1340">Upgrading to v1.34.0</a></h1>
<p>The <code>room_invite_state_types</code> configuration setting has been deprecated
and replaced with <code>room_prejoin_state</code>. See the <ahref="https://github.com/matrix-org/synapse/blob/v1.34.0/docs/sample_config.yaml#L1515">sample configuration
file</a>.</p>
<p>If you have set <code>room_invite_state_types</code> to the default value you
should simply remove it from your configuration file. The default value
<p>If you have customised this value, you should remove
<code>room_invite_state_types</code> and configure <code>room_prejoin_state</code> instead.</p>
<h1id="upgrading-to-v1330"><aclass="header"href="#upgrading-to-v1330">Upgrading to v1.33.0</a></h1>
<h2id="account-validity-html-templates-can-now-display-a-users-expiration-date"><aclass="header"href="#account-validity-html-templates-can-now-display-a-users-expiration-date">Account Validity HTML templates can now display a user's expiration date</a></h2>
<p>This may affect you if you have enabled the account validity feature,
and have made use of a custom HTML template specified by the
<p>The template can now accept an <code>expiration_ts</code> variable, which
represents the unix timestamp in milliseconds for the future date of
which their account has been renewed until. See the <ahref="https://github.com/matrix-org/synapse/blob/release-v1.33.0/synapse/res/templates/account_renewed.html">default
template</a>
for an example of usage.</p>
<p>ALso note that a new HTML template, <code>account_previously_renewed.html</code>,
has been added. This is is shown to users when they attempt to renew
their account with a valid renewal token that has already been used
before. The default template contents can been found
and can also accept an <code>expiration_ts</code> variable. This template replaces
the error message users would previously see upon attempting to use a
valid renewal token more than once.</p>
<h1id="upgrading-to-v1320"><aclass="header"href="#upgrading-to-v1320">Upgrading to v1.32.0</a></h1>
<h2id="regression-causing-connected-prometheus-instances-to-become-overwhelmed"><aclass="header"href="#regression-causing-connected-prometheus-instances-to-become-overwhelmed">Regression causing connected Prometheus instances to become overwhelmed</a></h2>
<h2id="dropping-support-for-old-python-postgres-and-sqlite-versions"><aclass="header"href="#dropping-support-for-old-python-postgres-and-sqlite-versions">Dropping support for old Python, Postgres and SQLite versions</a></h2>
<p>In line with our <ahref="deprecation_policy.html">deprecation policy</a>,
we've dropped support for Python 3.5 and PostgreSQL 9.5, as they are no
longer supported upstream.</p>
<p>This release of Synapse requires Python 3.6+ and PostgresSQL 9.6+ or
SQLite 3.22+.</p>
<h2id="removal-of-old-list-accounts-admin-api"><aclass="header"href="#removal-of-old-list-accounts-admin-api">Removal of old List Accounts Admin API</a></h2>
<p>The deprecated v1 "list accounts" admin API
(<code>GET /_synapse/admin/v1/users/<user_id></code>) has been removed in this
version.</p>
<p>The <ahref="admin_api/user_admin_api.html#list-accounts">v2 list accounts API</a>
has been available since Synapse 1.7.0 (2019-12-13), and is accessible
under <code>GET /_synapse/admin/v2/users</code>.</p>
<p>The deprecation of the old endpoint was announced with Synapse 1.28.0
(released on 2021-02-25).</p>
<h2id="application-services-must-use-type-mloginapplication_service-when-registering-users"><aclass="header"href="#application-services-must-use-type-mloginapplication_service-when-registering-users">Application Services must use type <code>m.login.application_service</code> when registering users</a></h2>
<p>In compliance with the <ahref="https://matrix.org/docs/spec/application_service/r0.1.2#server-admin-style-permissions">Application Service
spec</a>,
Application Services are now required to use the
<code>m.login.application_service</code> type when registering users via the
<code>/_matrix/client/r0/register</code> endpoint. This behaviour was deprecated in
Synapse v1.30.0.</p>
<p>Please ensure your Application Services are up to date.</p>
<h1id="upgrading-to-v1290"><aclass="header"href="#upgrading-to-v1290">Upgrading to v1.29.0</a></h1>
<h2id="requirement-for-x-forwarded-proto-header"><aclass="header"href="#requirement-for-x-forwarded-proto-header">Requirement for X-Forwarded-Proto header</a></h2>
<p>When using Synapse with a reverse proxy (in particular, when using the
<code>x_forwarded</code> option on an HTTP listener), Synapse now
expects to receive an <code>X-Forwarded-Proto</code> header on incoming
HTTP requests. If it is not set, Synapse will log a warning on each
received request.</p>
<p>To avoid the warning, administrators using a reverse proxy should ensure
that the reverse proxy sets <code>X-Forwarded-Proto</code> header to
<code>https</code> or <code>http</code> to indicate the protocol used
by the client.</p>
<p>Synapse also requires the <code>Host</code> header to be preserved.</p>
<p>See the <ahref="reverse_proxy.html">reverse proxy documentation</a>, where the
example configurations have been updated to show how to set these
headers.</p>
<p>(Users of <ahref="https://caddyserver.com/">Caddy</a> are unaffected, since we
believe it sets <code>X-Forwarded-Proto</code> by default.)</p>
<h1id="upgrading-to-v1270"><aclass="header"href="#upgrading-to-v1270">Upgrading to v1.27.0</a></h1>
<h2id="changes-to-callback-uri-for-oauth2--openid-connect-and-saml2"><aclass="header"href="#changes-to-callback-uri-for-oauth2--openid-connect-and-saml2">Changes to callback URI for OAuth2 / OpenID Connect and SAML2</a></h2>
<p>This version changes the URI used for callbacks from OAuth2 and SAML2
identity providers:</p>
<ul>
<li>
<p>If your server is configured for single sign-on via an OpenID
Connect or OAuth2 identity provider, you will need to add
<code>[synapse public baseurl]/_synapse/client/oidc/callback</code> to the list
of permitted "redirect URIs" at the identity provider.</p>
<p>See the <ahref="openid.html">OpenID docs</a> for more information on setting
up OpenID Connect.</p>
</li>
<li>
<p>If your server is configured for single sign-on via a SAML2 identity
provider, you will need to add
<code>[synapse public baseurl]/_synapse/client/saml2/authn_response</code> as a
permitted "ACS location" (also known as "allowed callback URLs")
at the identity provider.</p>
<p>The "Issuer" in the "AuthnRequest" to the SAML2 identity
provider is also updated to
<code>[synapse public baseurl]/_synapse/client/saml2/metadata.xml</code>. If
your SAML2 identity provider uses this property to validate or
otherwise identify Synapse, its configuration will need to be
updated to use the new URL. Alternatively you could create a new,
separate "EntityDescriptor" in your SAML2 identity provider with
the new URLs and leave the URLs in the existing "EntityDescriptor"
as they were.</p>
</li>
</ul>
<h2id="changes-to-html-templates"><aclass="header"href="#changes-to-html-templates">Changes to HTML templates</a></h2>
<p>The HTML templates for SSO and email notifications now have <ahref="https://jinja.palletsprojects.com/en/2.11.x/api/#autoescaping">Jinja2's
autoescape</a>
enabled for files ending in <code>.html</code>, <code>.htm</code>, and <code>.xml</code>. If you have
customised these templates and see issues when viewing them you might
need to update them. It is expected that most configurations will need
no changes.</p>
<p>If you have customised the templates <em>names</em> for these templates, it is
recommended to verify they end in <code>.html</code> to ensure autoescape is
enabled.</p>
<p>The above applies to the following templates:</p>
<ul>
<li><code>add_threepid.html</code></li>
<li><code>add_threepid_failure.html</code></li>
<li><code>add_threepid_success.html</code></li>
<li><code>notice_expiry.html</code></li>
<li><code>notice_expiry.html</code></li>
<li><code>notif_mail.html</code> (which, by default, includes <code>room.html</code> and
<h1id="upgrading-to-v1260"><aclass="header"href="#upgrading-to-v1260">Upgrading to v1.26.0</a></h1>
<h2id="rolling-back-to-v1250-after-a-failed-upgrade"><aclass="header"href="#rolling-back-to-v1250-after-a-failed-upgrade">Rolling back to v1.25.0 after a failed upgrade</a></h2>
<p>v1.26.0 includes a lot of large changes. If something problematic
occurs, you may want to roll-back to a previous version of Synapse.
Because v1.26.0 also includes a new database schema version, reverting
that version is also required alongside the generic rollback
instructions mentioned above. In short, to roll back to v1.25.0 you need
to:</p>
<ol>
<li>
<p>Stop the server</p>
</li>
<li>
<p>Decrease the schema version in the database:</p>
<pre><codeclass="language-sql">UPDATE schema_version SET version = 58;
</code></pre>
</li>
<li>
<p>Delete the ignored users & chain cover data:</p>
<pre><codeclass="language-sql">DROP TABLE IF EXISTS ignored_users;
<p>This release introduces a backwards-incompatible change to modules
making use of <code>ThirdPartyEventRules</code> in Synapse. If you make use of a
module defined under the <code>third_party_event_rules</code> config option, please
make sure it is updated to handle the below change:</p>
<p>The <code>http_client</code> argument is no longer passed to modules as they are
initialised. Instead, modules are expected to make use of the
<code>http_client</code> property on the <code>ModuleApi</code> class. Modules are now passed
a <code>module_api</code> argument during initialisation, which is an instance of
<code>ModuleApi</code>. <code>ModuleApi</code> instances have a <code>http_client</code> property which
acts the same as the <code>http_client</code> argument previously passed to
<code>ThirdPartyEventRules</code> modules.</p>
<h1id="upgrading-to-v1210"><aclass="header"href="#upgrading-to-v1210">Upgrading to v1.21.0</a></h1>
<h2id="forwarding-_synapseclient-through-your-reverse-proxy"><aclass="header"href="#forwarding-_synapseclient-through-your-reverse-proxy">Forwarding <code>/_synapse/client</code> through your reverse proxy</a></h2>
has been added to the <code>synapse/res/templates</code> directory. If you are
using a custom template directory, you may want to copy the template
over and modify it.</p>
<p>Note that as of v1.20.0, templates do not need to be included in custom
template directories for Synapse to start. The default templates will be
used if a custom template cannot be found.</p>
<p>This page will appear to the user after clicking a password reset link
that has been emailed to them.</p>
<p>To complete password reset, the page must include a way to make a
<code>POST</code> request to
<code>/_synapse/client/password_reset/{medium}/submit_token</code> with the query
parameters from the original link, presented as a URL-encoded form. See
the file itself for more details.</p>
<h2id="updated-single-sign-on-html-templates"><aclass="header"href="#updated-single-sign-on-html-templates">Updated Single Sign-on HTML Templates</a></h2>
<p>The <code>saml_error.html</code> template was removed from Synapse and replaced
with the <code>sso_error.html</code> template. If your Synapse is configured to use
SAML and a custom <code>sso_redirect_confirm_template_dir</code> configuration then
any customisations of the <code>saml_error.html</code> template will need to be
merged into the <code>sso_error.html</code> template. These templates are similar,
but the parameters are slightly different:</p>
<ul>
<li>The <code>msg</code> parameter should be renamed to <code>error_description</code>.</li>
<li>There is no longer a <code>code</code> parameter for the response code.</li>
<li>A string <code>error</code> parameter is available that includes a short hint
of why a user is seeing the error page.</li>
</ul>
<h1id="upgrading-to-v1180"><aclass="header"href="#upgrading-to-v1180">Upgrading to v1.18.0</a></h1>
<h2id="docker--py3-suffix-will-be-removed-in-future-versions"><aclass="header"href="#docker--py3-suffix-will-be-removed-in-future-versions">Docker <code>-py3</code> suffix will be removed in future versions</a></h2>
<p>From 10th August 2020, we will no longer publish Docker images with the
<code>-py3</code> tag suffix. The images tagged with the
<code>-py3</code> suffix have been identical to the non-suffixed tags
since release 0.99.0, and the suffix is obsolete.</p>
<p>On 10th August, we will remove the <code>latest-py3</code> tag.
Existing per-release tags (such as <code>v1.18.0-py3</code> will not
be removed, but no new <code>-py3</code> tags will be added.</p>
<p>Scripts relying on the <code>-py3</code> suffix will need to be
updated.</p>
<h2id="redis-replication-is-now-recommended-in-lieu-of-tcp-replication"><aclass="header"href="#redis-replication-is-now-recommended-in-lieu-of-tcp-replication">Redis replication is now recommended in lieu of TCP replication</a></h2>
<p>When setting up worker processes, we now recommend the use of a Redis
server for replication. <strong>The old direct TCP connection method is
deprecated and will be removed in a future release.</strong> See
<ahref="workers.html">workers</a> for more details.</p>
<h1id="upgrading-to-v1140"><aclass="header"href="#upgrading-to-v1140">Upgrading to v1.14.0</a></h1>
<p>This version includes a database update which is run as part of the
upgrade, and which may take a couple of minutes in the case of a large
server. Synapse will not respond to HTTP requests while this update is
taking place.</p>
<h1id="upgrading-to-v1130"><aclass="header"href="#upgrading-to-v1130">Upgrading to v1.13.0</a></h1>
<h2id="incorrect-database-migration-in-old-synapse-versions"><aclass="header"href="#incorrect-database-migration-in-old-synapse-versions">Incorrect database migration in old synapse versions</a></h2>
<p>A bug was introduced in Synapse 1.4.0 which could cause the room
directory to be incomplete or empty if Synapse was upgraded directly
from v1.2.1 or earlier, to versions between v1.4.0 and v1.12.x.</p>
<p>This will <em>not</em> be a problem for Synapse installations which were:</p>
<p>: - created at v1.4.0 or later,
- upgraded via v1.3.x, or
- upgraded straight from v1.2.1 or earlier to v1.13.0 or later.</p>
<p>If completeness of the room directory is a concern, installations which
are affected can be repaired as follows:</p>
<ol>
<li>
<p>Run the following sql from a <code>psql</code> or
<code>sqlite3</code> console:</p>
<pre><codeclass="language-sql">INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
<p>Plugins using the <code>complete_sso_login</code> method of
<code>synapse.module_api.ModuleApi</code> should update to using the async/await
version <code>complete_sso_login_async</code> which includes additional checks. The
non-async version is considered deprecated.</p>
<h2id="rolling-back-to-v1124-after-a-failed-upgrade"><aclass="header"href="#rolling-back-to-v1124-after-a-failed-upgrade">Rolling back to v1.12.4 after a failed upgrade</a></h2>
<p>v1.13.0 includes a lot of large changes. If something problematic
occurs, you may want to roll-back to a previous version of Synapse.
Because v1.13.0 also includes a new database schema version, reverting
that version is also required alongside the generic rollback
instructions mentioned above. In short, to roll back to v1.12.4 you need
to:</p>
<ol>
<li>
<p>Stop the server</p>
</li>
<li>
<p>Decrease the schema version in the database:</p>
<pre><codeclass="language-sql">UPDATE schema_version SET version = 57;
</code></pre>
</li>
<li>
<p>Downgrade Synapse by following the instructions for your
installation method in the "Rolling back to older versions"
section above.</p>
</li>
</ol>
<h1id="upgrading-to-v1120"><aclass="header"href="#upgrading-to-v1120">Upgrading to v1.12.0</a></h1>
<p>This version includes a database update which is run as part of the
upgrade, and which may take some time (several hours in the case of a
large server). Synapse will not respond to HTTP requests while this
update is taking place.</p>
<p>This is only likely to be a problem in the case of a server which is
participating in many rooms.</p>
<olstart="0">
<li>
<p>As with all upgrades, it is recommended that you have a recent
backup of your database which can be used for recovery in the event
of any problems.</p>
</li>
<li>
<p>As an initial check to see if you will be affected, you can try
running the following query from the <code>psql</code> or
<code>sqlite3</code> console. It is safe to run it while Synapse is
still running.</p>
<pre><codeclass="language-sql">SELECT MAX(q.v) FROM (
SELECT (
SELECT ej.json AS v
FROM state_events se INNER JOIN event_json ej USING (event_id)
WHERE se.room_id=rooms.room_id AND se.type='m.room.create' AND se.state_key=''
LIMIT 1
) FROM rooms WHERE rooms.room_version IS NULL
) q;
</code></pre>
<p>This query will take about the same amount of time as the upgrade
process: ie, if it takes 5 minutes, then it is likely that Synapse
will be unresponsive for 5 minutes during the upgrade.</p>
<p>If you consider an outage of this duration to be acceptable, no
further action is necessary and you can simply start Synapse 1.12.0.</p>
<p>If you would prefer to reduce the downtime, continue with the steps
below.</p>
</li>
<li>
<p>The easiest workaround for this issue is to manually create a new
index before upgrading. On PostgreSQL, his can be done as follows:</p>
<pre><codeclass="language-sql">CREATE INDEX CONCURRENTLY tmp_upgrade_1_12_0_index
ON state_events(room_id) WHERE type = 'm.room.create';
</code></pre>
<p>The above query may take some time, but is also safe to run while
Synapse is running.</p>
<p>We assume that no SQLite users have databases large enough to be
affected. If you <em>are</em> affected, you can run a similar query,
omitting the <code>CONCURRENTLY</code> keyword. Note however that this
operation may in itself cause Synapse to stop running for some time.
Synapse admins are reminded that <ahref="postgres.html">SQLite is not recommended for use
outside a test environment</a>.</p>
</li>
<li>
<p>Once the index has been created, the <code>SELECT</code> query in step 1 above
should complete quickly. It is therefore safe to upgrade to Synapse
1.12.0.</p>
</li>
<li>
<p>Once Synapse 1.12.0 has successfully started and is responding to
HTTP requests, the temporary index can be removed:</p>
<pre><codeclass="language-sql">DROP INDEX tmp_upgrade_1_12_0_index;
</code></pre>
</li>
</ol>
<h1id="upgrading-to-v1100"><aclass="header"href="#upgrading-to-v1100">Upgrading to v1.10.0</a></h1>
<p>Synapse will now log a warning on start up if used with a PostgreSQL
database that has a non-recommended locale set.</p>
<p>See <ahref="postgres.html">Postgres</a> for details.</p>
<h1id="upgrading-to-v180"><aclass="header"href="#upgrading-to-v180">Upgrading to v1.8.0</a></h1>
<p>Specifying a <code>log_file</code> config option will now cause Synapse to refuse
to start, and should be replaced by with the <code>log_config</code> option.
Support for the <code>log_file</code> option was removed in v1.3.0 and has since
had no effect.</p>
<h1id="upgrading-to-v170"><aclass="header"href="#upgrading-to-v170">Upgrading to v1.7.0</a></h1>
<p>In an attempt to configure Synapse in a privacy preserving way, the
default behaviours of <code>allow_public_rooms_without_auth</code> and
<code>allow_public_rooms_over_federation</code> have been inverted. This means that
by default, only authenticated users querying the Client/Server API will
be able to query the room directory, and relatedly that the server will
not share room directory information with other servers over federation.</p>
<p>If your installation does not explicitly set these settings one way or
the other and you want either setting to be <code>true</code> then it will
necessary to update your homeserver configuration file accordingly.</p>
<p>For more details on the surrounding context see our
<p>Following upgrade, to continue verifying email (e.g. as part of the
registration process), admins can either:-</p>
<ul>
<li>Configure Synapse to use an email server.</li>
<li>Run or choose an identity server which allows delegated email
verification and delegate to it.</li>
</ul>
<h4id="configure-smtp-in-synapse"><aclass="header"href="#configure-smtp-in-synapse">Configure SMTP in Synapse</a></h4>
<p>To configure an SMTP server for Synapse, modify the configuration
section headed <code>email</code>, and be sure to have at least the
<code>smtp_host, smtp_port</code> and <code>notif_from</code> fields filled out.</p>
<p>You may also need to set <code>smtp_user</code>, <code>smtp_pass</code>, and
<code>require_transport_security</code>.</p>
<p>See the <ahref="usage/configuration/homeserver_sample_config.html">sample configuration file</a>
for more details on these settings.</p>
<h4id="delegate-email-to-an-identity-server"><aclass="header"href="#delegate-email-to-an-identity-server">Delegate email to an identity server</a></h4>
<p>Some admins will wish to continue using email verification as part of
the registration process, but will not immediately have an appropriate
SMTP server at hand.</p>
<p>To this end, we will continue to support email verification delegation
via the <code>vector.im</code> and <code>matrix.org</code> identity servers for two months.
Support for delegated email verification will be disabled on Monday 2nd
December.</p>
<p>The <code>account_threepid_delegates</code> dictionary defines whether the
homeserver should delegate an external server (typically an <ahref="https://matrix.org/docs/spec/identity_service/r0.2.1">identity
server</a>) to handle
sending confirmation messages via email and SMS.</p>
<p>So to delegate email verification, in <code>homeserver.yaml</code>, set
<code>account_threepid_delegates.email</code> to the base URL of an identity