koajs / koa

Expressive middleware for node.js using ES2017 async functions

Home Page:https://koajs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[fix] Version 2.x introduced the URL object, which is not compatible with Node versions below 10.

kkdev163 opened this issue · comments

commented

Describe the bug

Node.js version: 8.11.2

OS version:

Description:

Actual behavior

2024-04-11 14:25:48,740[v2][music-puzzle-admin][music-puzzle-admin][195926][traceId][spanId][uid][0:0][ERROR][mug] - [-/10.200.xxx.xxx/-/58ms GET /puzzle/tag/module/48] nodejs.ReferenceError: URL is not defined

    at Object.redirect (/home/appops/music-puzzle-admin/music-puzzle-admin_online/default/approot/node_modules/koa/lib/response.js:266:7)

url = new URL(url).toString();

Expected behavior

Code to reproduce

Checklist

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.
  • I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.