feat(MED-85): fix wrong env variable name
This commit is contained in:
@@ -30,8 +30,7 @@ async function syncData() {
|
||||
const password = process.env.MEDIPOST_PASSWORD;
|
||||
const sender = process.env.MEDIPOST_MESSAGE_SENDER;
|
||||
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
|
||||
const supabaseServiceRoleKey =
|
||||
process.env.NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY;
|
||||
const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
|
||||
|
||||
if (
|
||||
!baseUrl ||
|
||||
@@ -68,7 +67,7 @@ async function syncData() {
|
||||
}
|
||||
: {};
|
||||
|
||||
const { data } = await axios.get(baseUrl, {
|
||||
const { data, status } = await axios.get(baseUrl, {
|
||||
params: {
|
||||
Action: 'GetPublicMessageList',
|
||||
User: user,
|
||||
@@ -79,11 +78,16 @@ async function syncData() {
|
||||
},
|
||||
});
|
||||
|
||||
if (!data || status !== 200) {
|
||||
console.error("Failed to get public message list, status: ", status, data);
|
||||
throw new Error('Failed to get public message list');
|
||||
}
|
||||
|
||||
if (data.code && data.code !== 0) {
|
||||
throw new Error('Failed to get public message list');
|
||||
}
|
||||
|
||||
if (!data.messages.length) {
|
||||
if (!data.messages?.length) {
|
||||
return supabase.schema('audit').from('sync_entries').insert({
|
||||
operation: 'ANALYSES_SYNC',
|
||||
comment: 'No new data received',
|
||||
|
||||
@@ -12,8 +12,7 @@ async function syncData() {
|
||||
|
||||
const baseUrl = process.env.CONNECTED_ONLINE_URL;
|
||||
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
|
||||
const supabaseServiceRoleKey =
|
||||
process.env.NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY;
|
||||
const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
|
||||
|
||||
if (!baseUrl || !supabaseUrl || !supabaseServiceRoleKey) {
|
||||
throw new Error('Could not access all necessary environment variables');
|
||||
|
||||
Reference in New Issue
Block a user