In your Netlify projects environment variable settings set this:
Key: AWS_LAMBDA_JS_RUNTIME
Value: nodejs18.x
Netlify Functions are built on AWS Lambda. Netlify allows us to provide a AWS_LAMBDA_JS_RUNTIME Env Var that sets the runtime for the function on AWS.
Native Fetch in Node is only available in Node 18 and above. I guess the default node version used is not Node 18.
Further reading:Lambda runtime optionsNode 18 announcementNetlify docs