vimo
vimo
CDCloudflare Developers
Created by vimo on 4/15/2024 in #functions
Thanks for still thinking about it.
@IEatBeans Sorry to tag you but I wanted to notify you of this thread I am creating. I cannot share the code snippet as such as I am not sure I know how to share a code snippet that would make sense 😛 But herees a psuedo code explaining that problem.
pages function - hello.js

onRequestGet() {
try {
const datares = await fetch(originurl)
//process the datares, send a Response with json data
}
catch {
// catch the error
// return a new Response with error details as json data
}
}
pages function - hello.js

onRequestGet() {
try {
const datares = await fetch(originurl)
//process the datares, send a Response with json data
}
catch {
// catch the error
// return a new Response with error details as json data
}
}
Now the problem with 500 internal error is that if hello.js can't fetch from the originurl (only when the originurl is down or inaccessible), it doesn't throw that error to be caught in the catch block for me. It just returns 500 internet error on the server side instead as the try catch block is only to look for fetch errors from the originurl. But the way functions works, it seems if originurl doesn't respond, the function errors out completely, like it terminates itself. So I can't handle inside the function. The only way to do that is to handle the possible function error on the frontend.
3 replies
RRailway
Created by macwilko on 8/14/2023 in #✋|help
CNAME vs ALIAS
I had not heard of it before, looks cool and much simpler to manage.
24 replies
RRailway
Created by macwilko on 8/14/2023 in #✋|help
CNAME vs ALIAS
I am very little knowledge about multitenancy, but wouldn't each domain have its own DNS records accessible through the API? so you can assign services based on the unique domain name anyway, isn't it?
24 replies
RRailway
Created by macwilko on 8/14/2023 in #✋|help
CNAME vs ALIAS
oh if it used to, then try it. it might resolve then.
24 replies
RRailway
Created by macwilko on 8/14/2023 in #✋|help
CNAME vs ALIAS
But I don't think railway has an option to choose anything other than CNAME to verify. I would suggest you a DNS proxy like Cloudlfare for your domain. Its free and quick to setup.
24 replies
RRailway
Created by macwilko on 8/14/2023 in #✋|help
CNAME vs ALIAS
Technically, you can as CNAME and Alias records achieve the same result.
24 replies