Read logs of a lambda function that has been proxied via _redirects

Hi. :wave:

I have deployed a golang function to a site that, let’s say, lives at https://www.example.com/.netlify/functions/foo

I added a proxy via the _redirects file that looks like this:

/* /.netlify/functions/foo:splat 200

Now my function can effectively be fired from any path.

Now, when I go to the function logs panel on Netlify’s dashboard, I only see logs for requests that went directly to the /.netlify/functions/foo path.

Is this a bug? How can I check the logs for the proxied requests? :thinking:

Hi @stefanmaric, you can’t currently see logs for a function that you trigger via a proxied address. We have an open issue to get this fixed but there are no solutions for it. You’ll have to trigger the function using it’s default address if you need logs for it.

1 Like

A bummer since needed to check some logs on prod. :cry:

Is the issue tracked publicly? A way to keep track of it? Maybe even a PR?

No way to publicly track it, but we will follow up in this thread if the situation changes.

I don’t think it’s on the roadmap at present, since you could choose to not proxy the function call, right? Then you’d get logs :slight_smile:

In the specific project that started this thread it has to be proxied due to :palm_tree:〖aesthetics〗:dolphin:, since the feature involves passing links around in SMS messages and other chat systems.

I was able to find the bug in prod in spite of the lack of logs; so not in a hurry anymore.

But for sure would be nice to match the expectation of logs appearing every time the function is run, independent of how it was called.

Perfect. Thanks!

1 Like

Great feedback! We have a LOT of work to do on functions logs and we are working on a logging infrastructure for both that and builds right now, so here’s hoping we get down the list of issues to that one in the process :slight_smile:

So glad to hear you got things sorted despite the missing logs!

2 Likes

Any update on this @fool? I’ve only just found this topic, as I assumed my logs were just not being very consistent à la Function logs are inconsistent in the Netlify Dashboard but yeah, I’m actually getting both of these effect - when I was talking directly to my function it was only logging some lines, and now I’m in prod with the redirect I get no logs. That’s pretty awful.

Now I know we get 125k invocations/100h for free so I can’t really complain, but yikes, if we were paying for these functions, I’d certainly be expecting logs to work!

As I mentioned to you in your other thread, we still have no intention of supporting being proxy’d to in this way, so nope, no news. I really will post a followup in this thread in case things change :wink:

You don’t even support the netlify.toml style “redirect” proxying?

Sorry, I should have been clearer: We don’t support being proxy’d to from OTHER SERVICES which is what I was describing as “in this way” since you already heard a mouthful in the other thread and I wasn’t planning to belabor it further.

Internal 200 rewrites, or proxying between Netlify sites in the same account (note that we do NOT allow proxying between accounts) are both fine, though both will likely prevent the logs you are hoping to see.

Okay cool, let’s separate this out then. For this issue, I’m talking from a position of someone who is not proxying from another service - I am just using netlify.toml redirects/rewrites so I don’t have the /.netlify/functions/ in the URLs, and my logging doesn’t work.

(Because, even though I am proxying from CloudFront on a given non-Netlify-domain URL, when I go to the actual Netlify URL I still don’t see function logs, so we can say that, for now, this has nothing to do with proxying from an external service. Of course, this might eventually be an additional use-case to add to this logging issue, but isn’t something we have to worry about until the internal-redirects logging issue itself is resolved.)

Hopefully that’s cleared it all up.

OK, let me try saying this in a different way, Alex :slight_smile:

  1. We do not provide technical support, or recommend that you proxy to us from another service such as cloudflare, cloudfront, your own server, google, or anywhere on the internet.
  2. Our function logging will not work unless you call your functions with the explicit path of https://your-custom-domain-or-autogenerated-netlify-sitename/.netlify/functions/function-name . This is independent of #1.