Without knowing your site, we cannot debug.
It’s cupra-occasions
Hi @Rutger,
If you go here:
And then from the field Search by branch or Deploy Preview number, select the branch or deploy preview that has the function, you should then be able to view the function logs:
Hi @Rutger, I’m having what seems like the same exact issue. Have you managed to find a solution?
can you share your site name so we can look into this? Have you looked at the function logs?
Yes, the logs are empty even if I try logging something right at the top of the handler function.
I’ve since came across this - Unable to run a function alongside a generated Nuxt app - #12 by hrishikesh, and the workaround of removing the /* /404.html 404 from _redirects did make the functions work.
Hi @Melvin,
Thank you for your response and sorry for getting back so late. I somehow managed to fix this although I don’t know how.
I’m currently working on a new application and experience the same issue. I created a function which responds to a GET request. Via netlify dev this works fine, but it doesn’t work on the Netlify platform. It returns a 500 without any details, similar to the aforementioned issue.
Site: cupra-honeymoon
Function URL: https://cupra-honeymoon.netlify.app/api/orders/1234/1234AB (this order number does not exists but this should return a 404 (with message “Order not found”) if the function would be invoked).
Beneath the function code I have this Config-block:
export const config: Config = {
path: '/api/orders/:orderNumber/:postalCode'
}
As said, locally this works fine. I don’t have a _redirects file and my netlify.toml looks like this:
[build]
command = "npm run build"
functions = "api"
publish = "dist"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
The function code is located in /api/retrieve-order/retrieve-order.ts.
Any idea?
–
Edit: maybe helpful: x-nf-request-id: 01JFEXKJK8ME148G8J0TJBFFG1
When removing
export const config: Config = {
path: '/api/orders/:orderNumber/:postalCode'
}
and getting parameters from the query parameters, it works.
So instead of:
const { orderNumber, postalCode } = context.params
I now use:
const searchParams = new URL(req.url).searchParams
const orderNumber = searchParams.get('ordernumber')
const postalCode = searchParams.get('postalcode')
I recall I had these same issues before.
We’ve deployed a fix, so your old deploy which had the previous code: 676418be043c35000861ff59–cupra-honeymoon.netlify.app/api/orders/1234/1234AB, now works fine.
Hi @hrishikesh, thanks! So there was not an issue with my code?
No, your particular case was a bug on our end which we fixed.
