• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

localstack / localstack / 22519085314

27 Feb 2026 11:47PM UTC coverage: 86.962% (+0.006%) from 86.956%
22519085314

push

github

web-flow
SNS: update store typing (#13866)

3 of 3 new or added lines in 1 file covered. (100.0%)

388 existing lines in 19 files now uncovered.

69828 of 80297 relevant lines covered (86.96%)

0.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.05
/localstack-core/localstack/deprecations.py
1
# A simple module to track deprecations over time / versions, and some simple functions guiding the affected users.
2
import logging
1✔
3
import os
1✔
4
from collections.abc import Callable
1✔
5
from dataclasses import dataclass
1✔
6

7
from localstack.utils.analytics import log
1✔
8

9
LOG = logging.getLogger(__name__)
1✔
10

11

12
@dataclass
1✔
13
class EnvVarDeprecation:
1✔
14
    """
15
    Simple class defining a deprecation of an environment variable config.
16
    It helps keeping track of deprecations over time.
17
    """
18

19
    env_var: str
1✔
20
    deprecation_version: str
1✔
21
    deprecation_path: str = None
1✔
22

23
    @property
1✔
24
    def is_affected(self) -> bool:
1✔
25
        """
26
        Checks whether an environment is affected.
27
        :return: true if the environment is affected / is using a deprecated config
28
        """
29
        return os.environ.get(self.env_var) is not None
1✔
30

31

32
#
33
# List of deprecations
34
#
35
# Please make sure this is in-sync with https://docs.localstack.cloud/references/configuration/
36
#
37
DEPRECATIONS = [
1✔
38
    # Since 0.12.8 - PORT_UI was removed
39
    EnvVarDeprecation(
40
        "PORT_WEB_UI",
41
        "0.12.8",
42
        "PORT_WEB_UI has been removed, and is not available anymore. Please remove this environment variable.",
43
    ),
44
    # Deprecated in 0.12.7, removed in 3.0.0
45
    EnvVarDeprecation(
46
        "USE_SINGLE_REGION",
47
        "0.12.7",
48
        "LocalStack now has full multi-region support. This option has no effect. Please remove it from your configuration.",  # noqa
49
    ),
50
    # Deprecated in 0.12.7, removed in 3.0.0
51
    EnvVarDeprecation(
52
        "DEFAULT_REGION",
53
        "0.12.7",
54
        "LocalStack now has full multi-region support. This option has no effect. Please remove it from your configuration.",  # noqa
55
    ),
56
    # Since 1.0.0 - New Persistence and file system
57
    EnvVarDeprecation(
58
        "DATA_DIR",
59
        "1.0.0",
60
        "Please use PERSISTENCE instead. The state will be stored in your LocalStack volume in the state/ directory.",
61
    ),
62
    EnvVarDeprecation(
63
        "HOST_TMP_FOLDER",
64
        "1.0.0",
65
        "This option has no effect anymore. Please remove this environment variable.",
66
    ),
67
    EnvVarDeprecation(
68
        "LEGACY_DIRECTORIES",
69
        "1.0.0",
70
        "This option has no effect anymore. Please migrate to the new filesystem layout (introduced with v1.0).",
71
    ),
72
    EnvVarDeprecation(
73
        "TMPDIR", "1.0.0", "Please migrate to the new filesystem layout (introduced with v1.0)."
74
    ),
75
    EnvVarDeprecation(
76
        "PERSISTENCE_SINGLE_FILE",
77
        "1.0.0",
78
        "The legacy persistence mechanism is not supported anymore, please migrate to the advanced persistence mechanism of LocalStack Pro.",  # noqa
79
    ),
80
    # Since 1.0.0 - New ASF Gateway
81
    EnvVarDeprecation(
82
        "LEGACY_EDGE_PROXY",
83
        "1.0.0",
84
        "This option has no effect anymore. Please remove this environment variable.",
85
    ),
86
    # Since 1.1.0 - Kinesalite removed with 1.3, only kinesis-mock is used as kinesis provider / backend
87
    EnvVarDeprecation(
88
        "KINESIS_PROVIDER",
89
        "1.1.0",
90
        "This option has no effect anymore. Please remove this environment variable.",
91
    ),
92
    # Since 1.1.0 - Init dir has been deprecated in favor of pluggable init hooks
93
    EnvVarDeprecation(
94
        "LEGACY_INIT_DIR",
95
        "1.1.0",
96
        "This option has no effect anymore. "
97
        "Please use the pluggable initialization hooks in /etc/localhost/init/<stage>.d instead.",
98
    ),
99
    EnvVarDeprecation(
100
        "INIT_SCRIPTS_PATH",
101
        "1.1.0",
102
        "This option has no effect anymore. "
103
        "Please use the pluggable initialization hooks in /etc/localhost/init/<stage>.d instead.",
104
    ),
105
    # Since 1.3.0 - Synchronous events break AWS parity
106
    EnvVarDeprecation(
107
        "SYNCHRONOUS_SNS_EVENTS",
108
        "1.3.0",
109
        "This option has no effect anymore. Please remove this environment variable.",
110
    ),
111
    EnvVarDeprecation(
112
        "SYNCHRONOUS_SQS_EVENTS",
113
        "1.3.0",
114
        "This option has no effect anymore. Please remove this environment variable.",
115
    ),
116
    EnvVarDeprecation(
117
        "SYNCHRONOUS_API_GATEWAY_EVENTS",
118
        "1.3.0",
119
        "This option has no effect anymore. Please remove this environment variable.",
120
    ),
121
    EnvVarDeprecation(
122
        "SYNCHRONOUS_KINESIS_EVENTS",
123
        "1.3.0",
124
        "This option has no effect anymore. Please remove this environment variable.",
125
    ),
126
    EnvVarDeprecation(
127
        "SYNCHRONOUS_DYNAMODB_EVENTS",
128
        "1.3.0",
129
        "This option has no effect anymore. Please remove this environment variable.",
130
    ),
131
    # Since 1.3.0 - All non-pre-seeded infra is downloaded asynchronously
132
    EnvVarDeprecation(
133
        "SKIP_INFRA_DOWNLOADS",
134
        "1.3.0",
135
        "Infra downloads are triggered on-demand now. Please remove this environment variable.",
136
    ),
137
    # Since 1.3.0 - Mocking for unimplemented operations will be removed
138
    EnvVarDeprecation(
139
        "MOCK_UNIMPLEMENTED",
140
        "1.3.0",
141
        "This feature is not supported anymore. Please remove this environment variable.",
142
    ),
143
    # Since 1.4.0 - The Edge Forwarding is only used for legacy HTTPS proxying and will be removed
144
    EnvVarDeprecation(
145
        "EDGE_FORWARD_URL",
146
        "1.4.0",
147
        "This option has no effect anymore. Please remove this environment variable.",
148
    ),
149
    # Deprecated in 1.4.0, removed in 3.0.0
150
    EnvVarDeprecation(
151
        "KMS_PROVIDER",
152
        "1.4.0",
153
        "This option has no effect. Please remove it from your configuration.",
154
    ),
155
    # Since 2.0.0 - HOSTNAME_EXTERNAL will be replaced with LOCALSTACK_HOST
156
    EnvVarDeprecation(
157
        "HOSTNAME_EXTERNAL",
158
        "2.0.0",
159
        "This configuration will be migrated to LOCALSTACK_HOST",
160
    ),
161
    # Since 2.0.0 - LOCALSTACK_HOST will be replaced with LOCALSTACK_HOST
162
    EnvVarDeprecation(
163
        "LOCALSTACK_HOSTNAME",
164
        "2.0.0",
165
        "This configuration will be migrated to LOCALSTACK_HOST",
166
    ),
167
    # Since 2.0.0 - redefined as GATEWAY_LISTEN
168
    EnvVarDeprecation(
169
        "EDGE_BIND_HOST",
170
        "2.0.0",
171
        "This configuration will be migrated to GATEWAY_LISTEN",
172
    ),
173
    # Since 2.0.0 - redefined as GATEWAY_LISTEN
174
    EnvVarDeprecation(
175
        "EDGE_PORT",
176
        "2.0.0",
177
        "This configuration will be migrated to GATEWAY_LISTEN",
178
    ),
179
    # Since 2.0.0 - redefined as GATEWAY_LISTEN
180
    EnvVarDeprecation(
181
        "EDGE_PORT_HTTP",
182
        "2.0.0",
183
        "This configuration will be migrated to GATEWAY_LISTEN",
184
    ),
185
    EnvVarDeprecation(
186
        "LAMBDA_EXECUTOR",
187
        "2.0.0",
188
        "This configuration is obsolete with the new lambda provider "
189
        "https://docs.localstack.cloud/user-guide/aws/lambda/#migrating-to-lambda-v2\n"
190
        "Please mount the Docker socket /var/run/docker.sock as a volume when starting LocalStack.",
191
    ),
192
    EnvVarDeprecation(
193
        "LAMBDA_STAY_OPEN_MODE",
194
        "2.0.0",
195
        "Stay open mode is the default behavior in the new lambda provider "
196
        "https://docs.localstack.cloud/user-guide/aws/lambda/#migrating-to-lambda-v2",
197
    ),
198
    EnvVarDeprecation(
199
        "LAMBDA_REMOTE_DOCKER",
200
        "2.0.0",
201
        "The new lambda provider copies zip files by default and automatically configures hot reloading "
202
        "https://docs.localstack.cloud/user-guide/aws/lambda/#migrating-to-lambda-v2",
203
    ),
204
    EnvVarDeprecation(
205
        "LAMBDA_CODE_EXTRACT_TIME",
206
        "2.0.0",
207
        "Function creation now happens asynchronously in the new lambda provider "
208
        "https://docs.localstack.cloud/user-guide/aws/lambda/#migrating-to-lambda-v2",
209
    ),
210
    EnvVarDeprecation(
211
        "LAMBDA_CONTAINER_REGISTRY",
212
        "2.0.0",
213
        "The new lambda provider uses LAMBDA_RUNTIME_IMAGE_MAPPING instead "
214
        "https://docs.localstack.cloud/user-guide/aws/lambda/#migrating-to-lambda-v2",
215
    ),
216
    EnvVarDeprecation(
217
        "LAMBDA_FALLBACK_URL",
218
        "2.0.0",
219
        "This feature is not supported in the new lambda provider "
220
        "https://docs.localstack.cloud/user-guide/aws/lambda/#migrating-to-lambda-v2",
221
    ),
222
    EnvVarDeprecation(
223
        "LAMBDA_FORWARD_URL",
224
        "2.0.0",
225
        "This feature is not supported in the new lambda provider "
226
        "https://docs.localstack.cloud/user-guide/aws/lambda/#migrating-to-lambda-v2",
227
    ),
228
    EnvVarDeprecation(
229
        "LAMBDA_XRAY_INIT",
230
        "2.0.0",
231
        "The X-Ray daemon is always initialized in the new lambda provider "
232
        "https://docs.localstack.cloud/user-guide/aws/lambda/#migrating-to-lambda-v2",
233
    ),
234
    EnvVarDeprecation(
235
        "KINESIS_INITIALIZE_STREAMS",
236
        "1.4.0",
237
        "This option has no effect anymore. Please use the AWS client and init hooks instead.",
238
    ),
239
    EnvVarDeprecation(
240
        "SQS_PORT_EXTERNAL",
241
        "1.0.0",
242
        "This option has no effect anymore. Please use LOCALSTACK_HOST instead.",
243
    ),
244
    EnvVarDeprecation(
245
        "PROVIDER_OVERRIDE_LAMBDA",
246
        "3.0.0",
247
        "This option is ignored because the legacy Lambda provider (v1) has been removed since 3.0.0. "
248
        "Please remove PROVIDER_OVERRIDE_LAMBDA and migrate to our new Lambda provider (v2): "
249
        "https://docs.localstack.cloud/user-guide/aws/lambda/#migrating-to-lambda-v2",
250
    ),
251
    EnvVarDeprecation(
252
        "ES_CUSTOM_BACKEND",
253
        "0.14.0",
254
        "This option has no effect anymore. Please use OPENSEARCH_CUSTOM_BACKEND instead.",
255
    ),
256
    EnvVarDeprecation(
257
        "ES_MULTI_CLUSTER",
258
        "0.14.0",
259
        "This option has no effect anymore. Please use OPENSEARCH_MULTI_CLUSTER instead.",
260
    ),
261
    EnvVarDeprecation(
262
        "ES_ENDPOINT_STRATEGY",
263
        "0.14.0",
264
        "This option has no effect anymore. Please use OPENSEARCH_ENDPOINT_STRATEGY instead.",
265
    ),
266
    EnvVarDeprecation(
267
        "PERSIST_ALL",
268
        "2.3.2",
269
        "LocalStack treats backends and assets the same with respect to persistence. Please remove PERSIST_ALL.",
270
    ),
271
    EnvVarDeprecation(
272
        "DNS_LOCAL_NAME_PATTERNS",
273
        "3.0.0",
274
        "This option was confusingly named. Please use DNS_NAME_PATTERNS_TO_RESOLVE_UPSTREAM "
275
        "instead.",
276
    ),
277
    EnvVarDeprecation(
278
        "LAMBDA_EVENTS_INTERNAL_SQS",
279
        "4.0.0",
280
        "This option is ignored because the LocalStack SQS dependency for event invokes has been removed since 4.0.0"
281
        " in favor of a lightweight Lambda-internal SQS implementation.",
282
    ),
283
    EnvVarDeprecation(
284
        "LAMBDA_EVENT_SOURCE_MAPPING",
285
        "4.0.0",
286
        "This option has no effect anymore. Please remove this environment variable.",
287
    ),
288
    EnvVarDeprecation(
289
        "LAMBDA_SQS_EVENT_SOURCE_MAPPING_INTERVAL_SEC",
290
        "4.0.0",
291
        "This option is not supported by the new Lambda Event Source Mapping v2 implementation."
292
        " Please create a GitHub issue if you experience any performance challenges.",
293
    ),
294
    EnvVarDeprecation(
295
        "PROVIDER_OVERRIDE_STEPFUNCTIONS",
296
        "4.0.0",
297
        "This option is ignored because the legacy StepFunctions provider (v1) has been removed since 4.0.0."
298
        " Please remove PROVIDER_OVERRIDE_STEPFUNCTIONS.",
299
    ),
300
    EnvVarDeprecation(
301
        "EVENT_RULE_ENGINE",
302
        "4.0.3",
303
        "This option is ignored because the Java-based event ruler has been removed since 4.1.0."
304
        " Our latest Python-native implementation introduced in 4.0.3"
305
        " is faster, achieves great AWS parity, and fixes compatibility issues with the StepFunctions JSONata feature."
306
        " Please remove EVENT_RULE_ENGINE.",
307
    ),
308
    EnvVarDeprecation(
309
        "STEPFUNCTIONS_LAMBDA_ENDPOINT",
310
        "4.0.0",
311
        "This is only supported for the legacy provider. URL to use as the Lambda service endpoint in Step Functions. "
312
        "By default this is the LocalStack Lambda endpoint. Use default to select the original AWS Lambda endpoint.",
313
    ),
314
    EnvVarDeprecation(
315
        "LOCAL_PORT_STEPFUNCTIONS",
316
        "4.0.0",
317
        "This is only supported for the legacy provider."
318
        "It defines the local port to which Step Functions traffic is redirected."
319
        "By default, LocalStack routes Step Functions traffic to its internal runtime. "
320
        "Use this variable only if you need to redirect traffic to a different local Step Functions runtime.",
321
    ),
322
    EnvVarDeprecation(
323
        "ACTIVATE_PRO",
324
        "4.14.0",
325
        "Starting in March 2026, LocalStack will require an auth token. "
326
        "Go to this page for more infos: https://localstack.cloud/2026-updates",
327
    ),
328
]
329

330

331
def collect_affected_deprecations(
1✔
332
    deprecations: list[EnvVarDeprecation] | None = None,
333
) -> list[EnvVarDeprecation]:
334
    """
335
    Collects all deprecations which are used in the OS environ.
336
    :param deprecations: List of deprecations to check. Uses DEPRECATIONS list by default.
337
    :return: List of deprecations which are used in the current environment
338
    """
339
    if deprecations is None:
1✔
340
        deprecations = DEPRECATIONS
1✔
341
    return [deprecation for deprecation in deprecations if deprecation.is_affected]
1✔
342

343

344
def log_env_warning(deprecations: list[EnvVarDeprecation]) -> None:
1✔
345
    """
346
    Logs warnings for the given deprecations.
347
    :param deprecations: list of affected deprecations to show a warning for
348
    """
349
    """
1✔
350
    Logs a warning if a given environment variable is set (no matter what the value is).
351
    :param env_var: to check
352
    :param deprecation_version: version with which the env variable has been deprecated
353
    """
354
    if deprecations:
1✔
UNCOV
355
        env_vars = []
×
356

357
        # Print warnings for the env vars and collect them (for the analytics event)
UNCOV
358
        for deprecation in deprecations:
×
359
            LOG.warning(
×
360
                "%s is deprecated (since %s) and will be removed in upcoming releases of LocalStack! %s",
361
                deprecation.env_var,
362
                deprecation.deprecation_version,
363
                deprecation.deprecation_path,
364
            )
UNCOV
365
            env_vars.append(deprecation.env_var)
×
366

367
        # Log an event if deprecated env vars are used
UNCOV
368
        log.event(event="deprecated_env_usage", payload={"deprecated_env_vars": env_vars})
×
369

370

371
def log_deprecation_warnings(deprecations: list[EnvVarDeprecation] | None = None) -> None:
1✔
372
    affected_deprecations = collect_affected_deprecations(deprecations)
1✔
373
    log_env_warning(affected_deprecations)
1✔
374

375
    provider_override_events = os.environ.get("PROVIDER_OVERRIDE_EVENTS")
1✔
376
    if provider_override_events and provider_override_events in ["v1", "legacy"]:
1✔
UNCOV
377
        env_var_value = f"PROVIDER_OVERRIDE_EVENTS={provider_override_events}"
×
UNCOV
378
        deprecation_version = "4.0.0"
×
UNCOV
379
        deprecation_path = f"Remove {env_var_value} to use the new EventBridge implementation."
×
UNCOV
380
        LOG.warning(
×
381
            "%s is deprecated (since %s) and will be removed in upcoming releases of LocalStack! %s",
382
            env_var_value,
383
            deprecation_version,
384
            deprecation_path,
385
        )
386

387

388
def deprecated_endpoint(
1✔
389
    endpoint: Callable, previous_path: str, deprecation_version: str, new_path: str
390
) -> Callable:
391
    """
392
    Wrapper function which logs a warning (and a deprecation path) whenever a deprecated URL is invoked by the router.
393

394
    :param endpoint: to wrap (log a warning whenever it is invoked)
395
    :param previous_path: route path it is triggered by
396
    :param deprecation_version: version of LocalStack with which this endpoint is deprecated
397
    :param new_path: new route path which should be used instead
398
    :return: wrapped function which can be registered for a route
399
    """
400

401
    def deprecated_wrapper(*args, **kwargs):
1✔
402
        LOG.warning(
1✔
403
            "%s is deprecated (since %s) and will be removed in upcoming releases of LocalStack! Use %s instead.",
404
            previous_path,
405
            deprecation_version,
406
            new_path,
407
        )
408
        return endpoint(*args, **kwargs)
1✔
409

410
    return deprecated_wrapper
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc