updates
This commit is contained in:
parent
1054e2c839
commit
2f1f970267
|
|
@ -84,9 +84,11 @@
|
|||
### 11. 404 Errors for Newly Created Records
|
||||
- **Problem**: Newly created records sometimes show 404 when immediately updating/linking
|
||||
- **Solution**:
|
||||
- Added better error logging to identify when this happens
|
||||
- Added retry mechanism with exponential backoff to `updateInterest` function
|
||||
- Will retry up to 3 times with increasing delays (1s, 2s, 3s)
|
||||
- `get-interest-berths` returns empty list instead of throwing error for new records
|
||||
- This appears to be a sync delay in NocoDB - record needs a moment to propagate
|
||||
- This handles NocoDB synchronization delays where records need time to propagate
|
||||
- After 3 retries, provides detailed error message explaining possible causes
|
||||
|
||||
## Required Environment Variables
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ export const getInterestById = async (id: string) =>
|
|||
},
|
||||
});
|
||||
|
||||
export const updateInterest = async (id: string, data: Partial<Interest>) => {
|
||||
console.log('[nocodb.updateInterest] Updating interest:', id);
|
||||
export const updateInterest = async (id: string, data: Partial<Interest>, retryCount = 0): Promise<Interest> => {
|
||||
console.log('[nocodb.updateInterest] Updating interest:', id, 'Retry:', retryCount);
|
||||
console.log('[nocodb.updateInterest] Data fields:', Object.keys(data));
|
||||
|
||||
// Create a clean data object that matches the InterestsRequest schema
|
||||
|
|
@ -110,12 +110,24 @@ export const updateInterest = async (id: string, data: Partial<Interest>) => {
|
|||
console.error('[nocodb.updateInterest] Update failed:', error);
|
||||
console.error('[nocodb.updateInterest] Error details:', error instanceof Error ? error.message : 'Unknown error');
|
||||
|
||||
// If it's a 404 error for a newly created record, provide more context
|
||||
// If it's a 404 error and we haven't retried too many times, wait and retry
|
||||
if ((error.statusCode === 404 || error.status === 404) && retryCount < 3) {
|
||||
console.error('[nocodb.updateInterest] 404 Error - Record not found. This might be a sync delay.');
|
||||
console.error(`Retrying in ${(retryCount + 1) * 1000}ms... (Attempt ${retryCount + 1}/3)`);
|
||||
|
||||
// Wait with exponential backoff
|
||||
await new Promise(resolve => setTimeout(resolve, (retryCount + 1) * 1000));
|
||||
|
||||
// Retry the update
|
||||
return updateInterest(id, data, retryCount + 1);
|
||||
}
|
||||
|
||||
// If it's still a 404 after retries, provide detailed error
|
||||
if (error.statusCode === 404 || error.status === 404) {
|
||||
console.error('[nocodb.updateInterest] 404 Error - Record not found. This might happen if:');
|
||||
console.error('[nocodb.updateInterest] 404 Error - Record not found after 3 retries. This might happen if:');
|
||||
console.error('1. The record ID is incorrect');
|
||||
console.error('2. The record was just created and is not yet available');
|
||||
console.error('3. The record was deleted');
|
||||
console.error('2. The record was deleted');
|
||||
console.error('3. There is a synchronization issue with the database');
|
||||
console.error('Attempted URL:', url);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue