@@ -31,9 +31,12 @@ class LocalLambdaStack(Stack):
3131
3232 def __init__ (self , scope : Construct , construct_id : str , ** kwargs ) -> None :
3333 host = kwargs .pop ("host" , "host-not-specified" )
34+ dsn = f"http://123@{ host } :9999/0" # noqa: E231
3435
3536 super ().__init__ (scope , construct_id , ** kwargs )
36- print ("[LocalLambdaStack] Creating local SAM Lambda Stack: %s" % self )
37+ print (
38+ "[LocalLambdaStack] Creating local SAM Lambda Stack (Sentry DSN: %s)" % dsn
39+ )
3740
3841 # Override the template synthesis
3942 self .template_options .template_format_version = "2010-09-09"
@@ -85,7 +88,7 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
8588 ], # Add layer containing the Sentry SDK to function.
8689 "Environment" : {
8790 "Variables" : {
88- "SENTRY_DSN" : f"http://123@ { host } :9999/0" ,
91+ "SENTRY_DSN" : dsn ,
8992 "SENTRY_INITIAL_HANDLER" : "index.handler" ,
9093 "SENTRY_TRACES_SAMPLE_RATE" : "1.0" ,
9194 }
@@ -109,7 +112,7 @@ def wait_for_stack(cls, timeout=30, port=SAM_PORT):
109112 while True :
110113 if time .time () - start_time > timeout :
111114 raise TimeoutError (
112- "SAM failed to start within %s seconds. (Maybe Docker is not running?)"
115+ "AWS SAM failed to start within %s seconds. (Maybe Docker is not running?)"
113116 % timeout
114117 )
115118
@@ -173,7 +176,9 @@ def run_server(self):
173176 uvicorn .run (self .app , host = self .host , port = self .port , log_level = self .log_level )
174177
175178 def start (self ):
176- print ("[SentryServerForTesting] Starting server on %s:%s" % (self .host , self .port ))
179+ print (
180+ "[SentryServerForTesting] Starting server on %s:%s" % (self .host , self .port )
181+ )
177182 server_thread = threading .Thread (target = self .run_server , daemon = True )
178183 server_thread .start ()
179184
0 commit comments