Fix Next.js deployment configuration
- Fix security test to properly mock fetchFromConfluence errors - Remove test execution from build (env vars not available in build) - Remove standalone output for Amplify compatibility - Platform already updated to WEB_COMPUTE via Terraform 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -43,11 +43,15 @@ describe('API Security Tests', () => {
|
||||
});
|
||||
|
||||
it('should not expose internal error details', async () => {
|
||||
// Set invalid environment to trigger error
|
||||
process.env.CONFLUENCE_API_URL = 'invalid-url';
|
||||
// Set valid environment
|
||||
process.env.CONFLUENCE_API_URL = 'https://test.atlassian.net';
|
||||
process.env.CONFLUENCE_TOKEN = 'test-token';
|
||||
process.env.CONFLUENCE_PAGE_ID = 'test-page';
|
||||
|
||||
// Mock fetchFromConfluence to throw an error
|
||||
const mockFetchFromConfluence = fetchFromConfluence as jest.MockedFunction<typeof fetchFromConfluence>;
|
||||
mockFetchFromConfluence.mockRejectedValueOnce(new Error('Internal database error with sensitive details'));
|
||||
|
||||
const response = await GET();
|
||||
const data = await response.json();
|
||||
|
||||
@@ -55,5 +59,7 @@ describe('API Security Tests', () => {
|
||||
expect(data.error).toBe('Failed to fetch filaments');
|
||||
expect(data).not.toHaveProperty('stack');
|
||||
expect(data).not.toHaveProperty('message');
|
||||
expect(JSON.stringify(data)).not.toContain('Internal database error');
|
||||
expect(JSON.stringify(data)).not.toContain('sensitive details');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user