Skip to content

Commit 980f8e2

Browse files
committed
always use sentry code path, just don't send when no dsn in dev
1 parent 012027b commit 980f8e2

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

apps/updateserver/Application.cfc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ component {
9393
application.downloadsUrl = server.system.environment.DOWNLOADS_URL ?: "https://download.lucee.org/";
9494
application.updateProviderUrl = server.system.environment.UPDATE_PROVIDER ?: "https://update.lucee.org/rest/update/provider/";
9595
application.extensionProviderUrl = server.system.environment.EXTENSION_PROVIDER ?: "https://extensions.lucee.org/rest/extension/provider/";
96-
application.sentryDsn = server.system.environment.SENTRY_DSN ?: "https://[email protected]/4507452800040960";
97-
96+
application.sentryDsn = server.system.environment.SENTRY_DSN ?: "";
9897

9998
if ( left( application.coreS3Root, 3 ) == "s3:"
10099
&& ( len( this.s3.awsSecretKey ) == 0 || len( this.s3.accessKeyId ) == 0) ) {

apps/updateserver/services/ExtensionMetadataReader.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ component accessors=true {
2626

2727
if (meta.recordcount == 0){
2828
// rebuilding the index takes a while as all extensions need to be re-downloaded and processed
29-
setting requesttimeout="#lexFiles.recordcount#*4";
29+
setting requesttimeout="#(lexFiles.recordcount*4)#";
3030
}
3131

3232
for( var lexFile in lexFiles ) {

apps/updateserver/services/SentryLogger.cfc

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@ component {
1616
public function init( required struct config ) {
1717
variables.config = arguments.config;
1818

19-
// Validate required config keys
20-
if ( !structKeyExists( variables.config, "dsn" ) || isEmpty( variables.config.dsn ) ) {
21-
throw( type="Sentry.ConfigurationException", message="Missing required configuration key: dsn" );
19+
// DSN is optional - if not provided or empty, logger will exercise all code paths but not send to Sentry
20+
// Strip quotes in case DSN comes through as literal '""' string from environment variables
21+
var cleanDsn = trim( replace( variables.config.dsn ?: "", '""', '', 'all' ) );
22+
if ( len( cleanDsn ) && cleanDsn neq '""' ) {
23+
// Parse the DSN
24+
variables.sentryInfo = _parseDsn( cleanDsn );
25+
variables.hasDsn = true;
26+
} else {
27+
variables.hasDsn = false;
2228
}
2329

24-
// Parse the DSN
25-
variables.sentryInfo = _parseDsn( variables.config.dsn );
26-
2730
// Set defaults
2831
if ( !structKeyExists( variables.config, "environment" ) || isEmpty( variables.config.environment ) ) {
2932
variables.config.environment = "production";
@@ -179,6 +182,17 @@ component {
179182
* Sends an event to Sentry via HTTP.
180183
*/
181184
private struct function _sendEvent( required struct event ) {
185+
// If no DSN configured, skip the HTTP call but return success
186+
// This allows full code path testing in dev without sending to Sentry
187+
if ( !variables.hasDsn ) {
188+
return {
189+
"success" = true,
190+
"eventId" = arguments.event.event_id,
191+
"statusCode" = "200",
192+
"note" = "No DSN configured - event not sent to Sentry"
193+
};
194+
}
195+
182196
var fullUrl = variables.sentryInfo.apiUrl;
183197
var timestamp = _getTimestamp();
184198

0 commit comments

Comments
 (0)