MCPcopy Index your code
hub / github.com/CapSoftware/Cap / getS3ConnectionErrorMessage

Function getS3ConnectionErrorMessage

apps/web/actions/organization/storage.ts:177–209  ·  view source on GitHub ↗
(error: unknown, bucketName: string)

Source from the content-addressed store, hash-verified

175};
176
177const getS3ConnectionErrorMessage = (error: unknown, bucketName: string) => {
178 if (!(error instanceof Error)) return "Failed to connect to S3";
179
180 if (error.name === "AbortError" || error.name === "TimeoutError") {
181 return "Connection timed out after 5 seconds. Please check the endpoint URL and your network connection.";
182 }
183
184 if (error.name === "NoSuchBucket") {
185 return `Bucket '${bucketName}' does not exist`;
186 }
187
188 if (error.name === "NetworkingError") {
189 return "Network error. Please check the endpoint URL and your network connection.";
190 }
191
192 if (error.name === "InvalidAccessKeyId") {
193 return "Invalid Access Key ID";
194 }
195
196 if (error.name === "SignatureDoesNotMatch") {
197 return "Invalid Secret Access Key";
198 }
199
200 if (error.name === "AccessDenied") {
201 return "Access denied. Please check your credentials and bucket permissions.";
202 }
203
204 if (getS3ErrorMetadata(error)?.httpStatusCode === 301) {
205 return "Received 301 redirect. This usually means the endpoint URL is incorrect or the bucket is in a different region.";
206 }
207
208 return "Failed to connect to S3";
209};
210
211const driveHasStoredData = async (
212 drive: typeof storageIntegrations.$inferSelect,

Callers 1

testOrganizationS3ConfigFunction · 0.85

Calls 1

getS3ErrorMetadataFunction · 0.70

Tested by

no test coverage detected