I'm trying to deploy a proxy by using this repository: https://github.com/theBliz/cmc-proxy . (I basically cloned the entire repository, and the only thing I changed is an API key which is required to use an API)
However when I try to deploy the project on Vercel, I get the following error:
Error: Cannot convert undefined or null to object
The full logs is:
2022-09-30T08:14:05.536Z Retrieving list of deployment files...
2022-09-30T08:14:05.777Z
2022-09-30T08:14:08.322Z Downloading 8 deployment files...
2022-09-30T08:14:08.949Z Looking up build cache...
2022-09-30T08:14:09.390Z Build Cache not found
2022-09-30T08:14:09.423Z Running "vercel build"
2022-09-30T08:14:09.921Z Vercel CLI 28.4.4
2022-09-30T08:14:10.051Z WARN! Due to `builds` existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings
2022-09-30T08:14:10.061Z > Installing Builder: @now/node-server
2022-09-30T08:14:13.072Z downloading user files...
2022-09-30T08:14:13.073Z installing dependencies for user's code...
2022-09-30T08:14:13.083Z Installing dependencies...
2022-09-30T08:14:13.084Z Detected `package-lock.json` generated by npm 7+...
2022-09-30T08:14:15.802Z npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
2022-09-30T08:14:16.162Z npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
2022-09-30T08:14:16.292Z npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
2022-09-30T08:14:16.341Z npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
2022-09-30T08:14:17.430Z npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
2022-09-30T08:14:17.903Z npm WARN deprecated axios@0.18.1: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
2022-09-30T08:14:18.310Z
2022-09-30T08:14:18.310Z added 296 packages in 5s
2022-09-30T08:14:18.311Z
2022-09-30T08:14:18.311Z 8 packages are looking for funding
2022-09-30T08:14:18.311Z run `npm fund` for details
2022-09-30T08:14:18.327Z running user script...
2022-09-30T08:14:18.330Z preparing lambda files...
2022-09-30T08:14:18.330Z compiling entrypoint with ncc...
2022-09-30T08:14:18.595Z ncc: Version 0.18.5
2022-09-30T08:14:18.596Z ncc: Compiling file index.js
2022-09-30T08:14:20.362Z Error: Cannot convert undefined or null to object
This is my now.json:
{
"version": 2,
"name": "cmc-proxy",
"builds": [{ "src": "proxy.js", "use": "@now/node-server" }],
"routes":[{
"src": "/(.*)", "dest": "proxy.js"
}],
"env": {
"CMC_API_KEY": "@cmc_api_key"
}
}
The project does not have an index.js file, and it seems like the error is being thrown when its trying to compile index.js. I'm just trying to deploy a proxy so that I can use a certain API from the client side instead of building a full backend.
When I run "npm start" to run it locally, I dont have any issues and I can use the project.
How can I solve this issue?
I solved the problem, instead of using "@now/node-server", it should be "@vercel/node". The former is deprecated
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.