Getting error using 'experimental-edge' in robots.txt.js on cloudflare pages

For Workes & Pages, what is the name of the domain?

https://kallithechampion.in.net/robots.txt

What is the error message?

Internal Server Error

What is the issue or error you’re encountering

I recently shifted from vercel to cloudflare pages for next.js project and everything was working fine, but after adding export const runtime = ‘experimental-edge’; to my sitemap.xml.js and robots.txt. which is a requirement for cloudflare pages my both files getting error.js

What steps have you taken to resolve the issue?

My robots.txt.js code is - import { DOMAIN } from “…/config”;

export const runtime = ‘experimental-edge’;

const generateRobotsTxt = () => {
return User-agent: * Disallow: /images/ Sitemap: ${DOMAIN}/sitemap.xml ;
};

export const getServerSideProps = async ({ res }) => {
const robotsTxtContent = generateRobotsTxt();
res.setHeader(“Content-Type”, “text/plain”);
res.write(robotsTxtContent);
res.end();
return { props: {} };
};

const RobotsTxt = () => { return null; };
export default RobotsTxt;

But this code was working fine in vercel while in production, If I remove experimental-edge then cloudlfare will throw error. What can I do, I dont want to hardcode every file again and again

Screenshot of the error

Were you able to fix this ? I am facing some similar issue

No, You have to manually code it