Returning Content-Type XML from calling a function

Hey all,

I’m trying to create a function that acts as an RSS feed. I’ve got it working locally (using netlify-lambda), but when I deploy it to Netlify and try to access it, I see the following error in my logs:

error decoding lambda response: json: cannot unmarshal number into Go value of type string

This makes me wonder if it is even possible to respond with anything other than JSON?

1 Like

I just tested the following simple function. Looks like you can return xml.

const getResponse = myxml => ({
  statusCode: 200,
  headers: {
    'Content-Type': 'text/xml',
  body: myxml,

exports.handler = function(event, context, callback) {
  const response = getResponse(`<?xml version="1.0" encoding="UTF-8"?>
  <urlset xmlns="">
  callback(null, response)


1 Like

Thanks so much! I had the Content-Type set to application/rss+xml; charset=utf-8, which did not work. I’ve changed it to text/xml and now it does!

1 Like