I’m working on an app that reads form submissions and builds contact cards from that data. I have a build hook triggering this node file to run. I feel like I’m close but I’m getting a 401. Can anyone help me out here on how to make an Axios request to the Netlify API?
This will hopefully resolve the 401 issue. However, I also see a second likely pitfall once the 401 is resolved.
This code above appears to write the vCard to the local filesystem.
Serverless functions are not running on the CDN node itself. This means serverless functions can neither read from nor write to the site’s deployed files. You cannot modify a deployed site by writing to the functions filesystem. Only a new deploy can modify the site.
Thanks for the response! I was able to figure it out by toying with Postman. Form submission triggers a build hook, which runs this code. The only problem now is that I’m getting the error described here:
“git ref refs/heads/master does not exist or you do not have permission”
3:20:02 PM: Build ready to start
3:20:04 PM: build-image version: 53b83b6bede2920f236b25b6f5a95334320dc849
3:20:04 PM: build-image tag: v3.6.0
3:20:04 PM: buildbot version: e26592b49d9d56b21349effe1b8fab4d50845f11
3:20:04 PM: Fetching cached dependencies
3:20:04 PM: Failed to fetch cache, continuing with build
3:20:04 PM: Starting to prepare the repo for build
3:20:05 PM: git ref refs/heads/master does not exist or you do not have permission
3:20:05 PM: Failing build: Failed to prepare repo
3:20:05 PM: Failed during stage 'preparing repo': git ref refs/heads/master does not exist
3:20:05 PM: Finished processing build request in 741.096423ms