{"record":{"id":"39e38a5e4ed26517","repo":"nopSolutions/nopCommerce","slug":"client-id-is-not-set","errorCode":null,"errorMessage":"Client ID is not set","messagePattern":"Client ID is not set","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"critical","filePath":"src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs","lineNumber":115,"sourceCode":"        _workContext = workContext;\n        _upsSettings = upsSettings;\n    }\n\n    #endregion\n\n    #region Utilities\n\n    /// <summary>\n    /// Get access token\n    /// </summary>\n    /// <returns>The asynchronous task whose result contains access token</returns>\n    private async Task<string> GetAccessTokenAsync()\n    {\n        if (!string.IsNullOrEmpty(_accessToken))\n            return _accessToken;\n\n        if (string.IsNullOrEmpty(_upsSettings.ClientId))\n            throw new NopException(\"Client ID is not set\");\n\n        if (string.IsNullOrEmpty(_upsSettings.ClientSecret))\n            throw new NopException(\"Client secret is not set\");\n\n        var client = new OAuthClient(_httpClientFactory.CreateClient(NopHttpDefaults.DefaultHttpClient), _upsSettings);\n\n        var response = await client.GenerateTokenAsync();\n        _accessToken = response.Access_token;\n\n        return _accessToken;\n    }\n\n    /// <summary>\n    /// Get the weight limit for the selected weight measure\n    /// </summary>\n    /// <returns>\n    /// A task that represents the asynchronous operation\n    /// The task result contains the value","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs#L97-L133","documentation":"Thrown inside GetAccessTokenAsync (a private utility in UPSService) when the UPS ClientId setting is null or empty. This method lazily generates and caches an OAuth access token for UPS API calls. Without a ClientId, the OAuth token request to UPS cannot be constructed, so all subsequent UPS API operations (rate quotes, label generation, tracking) will fail.","triggerScenarios":"_upsSettings.ClientId is null or empty string when GetAccessTokenAsync is called and no cached _accessToken exists yet. This happens on the first UPS API call after application startup with unconfigured credentials.","commonSituations":"UPS plugin installed but credentials not entered; ClientId was registered on the UPS developer portal but not copied into plugin settings; settings were reset; environment-specific config (dev vs prod) not switched; credential field left blank during initial setup.","solutions":["Register an app on the UPS Developer Kit portal to obtain a Client ID and Client Secret","Enter the Client ID at Admin > Configuration > Shipping > UPS > Configure","Verify the setting persisted by checking Admin > Configuration > Shipping > UPS settings","Ensure the correct store scope is selected when entering credentials in multi-store setups"],"exampleFix":"// before\nvar rates = await _upsService.GetRatesAsync(request);\n\n// after — validate credentials before any UPS API call\nif (string.IsNullOrEmpty(_upsSettings.ClientId))\n    throw new InvalidOperationException(\"UPS Client ID is not configured\");\nvar rates = await _upsService.GetRatesAsync(request);","handlingStrategy":"validation","validationCode":"// Validate UPS Client ID before any shipping operation\nif (string.IsNullOrEmpty(_upsSettings.ClientId))\n    throw new InvalidOperationException(\"UPS Client ID is not configured. Set it in Admin > Shipping > UPS.\");","typeGuard":null,"tryCatchPattern":"// UPS errors throw directly (not wrapped); caller must catch\ntry\n{\n    var rates = await _upsService.GetRatesAsync(request);\n}\ncatch (NopException ex) when (ex.Message.Contains(\"Client ID\"))\n{\n    _logger.Error(\"UPS credentials missing — shipping rates unavailable\");\n    return ErrorResult(\"Shipping calculation temporarily unavailable\");\n}","preventionTips":["Configure UPS OAuth credentials (Client ID and Secret) immediately after plugin installation","Add a startup health check that verifies UPS credentials are present when the plugin is active","Display a configuration warning in the admin UI when UPS shipping is enabled without credentials","Store credentials in secure configuration — never hard-code or log them"],"tags":["ups","oauth","credentials","configuration","shipping","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}