Error exception "Expected keys to be an array of string" on Vercel deployment
obsnomad opened this issue · comments
Expected Behavior
No error when calling getAll().
Current Behavior
Working fine on dev environment, throws "Expected keys to be an array of string" exception on Vercel deployment.
Possible Solution
https://github.com/vercel/edge-config/blob/9689e9a0e21bba231e802074096a5a338f83c64f/src/index.ts#L257 should be conditioned like on line 265.
Was just arriving to call out the same issue. The assertion appears at odds with the functionality! 🥷🤺
https://github.com/vercel/edge-config/blob/main/src/index.ts#L34-L40
https://github.com/vercel/edge-config/blob/main/src/index.ts#L256-L262
Quick suggestion:
if (localEdgeConfig) {
if (keys !== undefined) {
assertIsKeys(keys);
}
return Array.isArray(keys)
? Promise.resolve(clone(pick(localEdgeConfig.items, keys)) as T)
: Promise.resolve(clone(localEdgeConfig.items) as T);
}
Perhaps more accurately:
if (localEdgeConfig) {
if (keys === undefined) {
Promise.resolve(clone(localEdgeConfig.items) as T);
}
assertIsKeys(keys);
return Promise.resolve(clone(pick(localEdgeConfig.items, keys)) as T)
}
Closing this as it shipped in #61