Hello everyone, really need your help!
I have a gatsby function that tries to read a JSON file ung fs.readFileAsync. My code works locally and even when yarn build / yarn serve is ran. But for some reason in netlify when I call my serverless function. It says “no such file or directory”
My folder structure looks like this…
-src -api -open-api-snippets.ts -content -open-api.json
I’ve tried multiple ways to call it but can’t seem to get it work once deployed in netlify. I’ve also tried adding this code in netlify.toml but still can’t seem to read it
included_files = [“content/**”]
Additionally, i’m trying to install the gatsby-plugin-netlify. But it shows and error in Netlify’s deploy logs:
2. build.command from netlify.toml 2:52:34 PM: ──────────────────────────────────────────────────────────────── 2:52:34 PM: 2:52:34 PM: $ yarn build 2:52:34 PM: yarn run v1.22.10 2:52:34 PM: $ gatsby build 2:52:38 PM: success compile gatsby files - 1.311s 2:52:38 PM: error There was a problem loading plugin "gatsby-plugin-netlify". Perhaps you need to install its package? 2:52:38 PM: Use --verbose to see actual error. 2:52:38 PM: not finished load gatsby config - 0.021s 2:52:38 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1) 2:52:38 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.