Closed
Description
Chore
Describe the chore
if createClient
is called and the supabaseKey
passed in is null
or undefined
then a non-specfic error thrown. This can happen if you make a call like this:
return createClient(
process.env.SUPABASE_URL,
process.env.SUPABASE_PUBLIC_KEY
);
and the env variable is empty.
The error is:
TypeError: Cannot read property 'length' of undefined
at SupabaseClient.initClient (/Users/zlwaterfield/programming/switch-log/node_modules/@supabase/supabase-js/lib/index.js:7:263)
at SupabaseClient.select (/Users/zlwaterfield/programming/switch-log/node_modules/@supabase/supabase-js/lib/index.js:7:920)
at CategoryRepository.findByLabel (webpack-internal:///./repositories/CategoryRepository.ts:12:54)
at LogEntry._findCategory (webpack-internal:///./services/LogEntryService.ts:86:42)
at LogEntry.timeStart (webpack-internal:///./services/LogEntryService.ts:17:31)
at __webpack_exports__.default (webpack-internal:///./pages/api/log.ts:11:31)
at apiResolver (/Users/zlwaterfield/programming/switch-log/node_modules/next/dist/next-server/server/api-utils.js:8:7)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async DevServer.handleApiRequest (/Users/zlwaterfield/programming/switch-log/node_modules/next/dist/next-server/server/next-server.js:45:397)
at async Object.fn (/Users/zlwaterfield/programming/switch-log/node_modules/next/dist/next-server/server/next-server.js:37:176)
We should add validation that the supabaseKey
is passed in or at least fix this line so the error is better handled.