#Astro errors are not logged to the console

2 messages · Page 1 of 1 (latest)

strong surge
#

So I have been getting errors not caught by the astro build process

and when I run the @astro/node standalone server I get 500 server but with nothing else anywhere.

I don't think this is normal

an example is to have an api endpoint with a middleware

and not formatting correctly the return of the api it do a 500 error but don't log to the console the MiddlewareNotAResponse: Any data returned from middleware must be a valid Response object.

I had to go in the entry.mjs and add a console.error in the catch like below

    } catch (err) {
+      console.log(err);
      if (!res.headersSent) {
        res.writeHead(500, `Server error`);
        res.end();
      }
    }

Is it normal or not ?

spiral folioBOT
#
No-one around right now?

It looks like no-one has responded to your question yet. People might not be available right now or don’t know how to answer your question. Want an answer while you wait? Try asking our experimental bot in #1095492539085230272.