Skip to content

Commit

Permalink
Fix serverless function errors
Browse files Browse the repository at this point in the history
  • Loading branch information
robmorieson committed Dec 21, 2022
1 parent 18c7595 commit fc60f1d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/rss.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Mailchimp from "mailchimp-api-v3";
const client = new Mailchimp(process.env.MAILCHIMP_API_KEY);

const getIssues = async () => {
const response = client.get("/campaigns", {
const response = await client.get("/campaigns", {
type: "regular",
status: "sent",
sort_field: "send_time",
Expand Down Expand Up @@ -41,11 +41,11 @@ const generateRSS = (issues) => {
return feed.xml({ indent: true });
};

export default async (_req, res) => {
export default async function rss(_req, res) {
const issues = await getIssues();
const rss = generateRSS(issues);

res.setHeader("Content-Type", "application/rss+xml");
res.setHeader("Cache-Control", "s-maxage=86400");
res.send(rss);
};
}

0 comments on commit fc60f1d

Please sign in to comment.