AlexPshul / nxazure

MIT License
16 stars 7 forks source link

Paths trying to read local.settings.json #17

Closed Falven closed 1 year ago

Falven commented 1 year ago

There's an issue with _registerPaths.ts trying to read local.settings.json during a build. This file won't be present, in say a CI environment as it's for local deployments only. You're not supposed to check this file into source control, so I don't think _registerPaths.ts should be trying to read/build this file?

Compiling TypeScript files for project "admin-api"...
Done compiling TypeScript files for project "admin-api".
Injecting tsconfig paths into function files for project "admin-api"...
 >  NX   ENOENT: no such file or directory, open 'apps/admin-api/local.settings.json'
Error: ENOENT: no such file or directory, open 'apps/admin-api/local.settings.json'
    at Object.openSync (node:fs:601:3)
    at readFileSync (node:fs:469:35)
    at readJsonFile (/home/vsts/work/1/s/node_modules/.pnpm/nx@16.2.1_@swc-node+register@1.6.4_@swc+core@1.3.52/node_modules/nx/src/utils/fileutils.js:18:43)
    at /home/vsts/work/1/s/node_modules/.pnpm/@nxazure+func@1.0.13_tslib@2.5.0/node_modules/@nxazure/func/src/executors/common/utils.js:57:53
    at Generator.next (<anonymous>)
    at /home/vsts/work/1/s/node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js:167:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/home/vsts/work/1/s/node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js:163:16)
    at getFilesForPathInjection (/home/vsts/work/1/s/node_modules/.pnpm/@nxazure+func@1.0.13_tslib@2.5.0/node_modules/@nxazure/func/src/executors/common/utils.js:56:55)
    at /home/vsts/work/1/s/node_modules/.pnpm/@nxazure+func@1.0.13_tslib@2.5.0/node_modules/@nxazure/func/src/executors/common/utils.js:110:33

https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=v4%2Cwindows%2Ccsharp%2Cportal%2Cbash#create-a-local-functions-project

AlexPshul commented 1 year ago

Hmmm that's odd. It should definitely not do this! Are you still using V3 functions model, by any chance?

Falven commented 1 year ago

Sorry, @AlexPshul , it's @nxazure/func/src/executors/common/utils reading this as you can see from the stacktrace

AlexPshul commented 1 year ago

Yeah, I saw that. I'm still not sure why it happens, though. I'll check it once I have a bit more time and update the issue here.

AlexPshul commented 1 year ago

Hi @Falven , I just published a fix in the new 1.0.17 release. Please have a look.

Also, I see that you are using the pre-colored console version. Once you upgrade to 1.0.17, you should see your console colored in the same way the func tool is coloring the output. Let me know if you find any issues there.

Thanks again for raising issues in the package. :)