Skip to content

Commit 9fd04ad

Browse files
committed
fix(network): reject missing gateway catalogs
1 parent 7d33009 commit 9fd04ad

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎apps/sim/lib/core/network/config.server.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ describe('outbound configuration', () => {
3434
expect(readSnapshot).not.toHaveBeenCalled()
3535
})
3636

37+
it.each([undefined, '{}'])(
38+
'rejects missing AppConfig gateway catalog %s before routing',
39+
(gateways) => {
40+
expect(() =>
41+
createOutboundRoutingReader(
42+
{
43+
...options,
44+
source: 'appconfig',
45+
configuration: undefined,
46+
gateways,
47+
},
48+
dependencies
49+
)
50+
).toThrow('INVALID_CONFIGURATION')
51+
}
52+
)
53+
3754
it('does not treat missing context as a personal workspace', async () => {
3855
const reader = createOutboundRoutingReader(options, dependencies)
3956
await expect(reader.resolve(undefined)).rejects.toThrow('MISSING_SCOPE')

‎apps/sim/lib/core/network/config.server.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const gatewaySchema = z.strictObject({
3232
})
3333
const gatewaysSchema = z
3434
.record(keySchema, gatewaySchema)
35-
.refine((value) => Object.keys(value).length <= 100)
35+
.refine((value) => Object.keys(value).length > 0 && Object.keys(value).length <= 100)
3636
const credentialSchema = z.strictObject({
3737
token: z
3838
.string()

0 commit comments

Comments
 (0)