Closed alexeigs closed 11 months ago
Well, I actually answered it myself when writing the issue I guess, and could resolve it by getting rid of the white space in my local path in Own Projects
-> own_projects
. As it may still be an issue users could ran into, and you might want to fix it, I leave it open but feel free to just close it otherwise.
Given I already shared all the code above, I will still add the following issue I'm facing in this thread; in case you have a helpful input that would be much appreciated!
The isolate
output is not as expected but for when I deploy the functions
folder, my setup seems to result in the common package to be looked for in node_modules
instead of ./packages/common
:
[2023-10-21T18:51:33.785Z] > [functions] package.json contents: {
"name": "functions",
"version": "0.0.0",
"scripts": {
"build": "tsc -b tsconfig.build.json",
"build:watch": "tsc --watch",
"serve": "npm run build && firebase emulators:start --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "18"
},
"main": "lib/index.js",
"dependencies": {
"common": "file:./packages/common",
"firebase-admin": "^11.8.0",
"firebase-functions": "^4.3.1"
},
"private": true
}
[2023-10-21T18:51:33.785Z] Building nodejs source
i functions: Loading and analyzing source code for codebase default to determine what to deploy
[2023-10-21T18:51:33.786Z] Could not find functions.yaml. Must use http discovery
[2023-10-21T18:51:33.798Z] Found firebase-functions binary at '/Users/<user>/Local/Dev/own_projects/<project>/node_modules/.bin/firebase-functions'
Serving at port 8243
[2023-10-21T18:51:34.086Z] Got response code 400; body Failed to generate manifest from function source: Error: Cannot find module '/Users/<user>/Local/Dev/own_projects/<project>/node_modules/common/dist'
shutdown requested via /__/quitquitquit
Hi Alexei,
Thanks for bringing the spaces in paths issue to my attention. That is an oversight. I think programmers traditionally avoid spaces exactly for this reason but modern software should of course just handle them correctly.
As for your remaining issue. I'm not sure what you mean with
my setup seems to result in the common package to be looked for in node_modules instead of ./packages/common:
The package json you posted is from the isolate output, right? The path there correctly points to "file:./packages/common", so I'm not sure what part of your setup you are referring to.
One thing I can think of is that your build script from package.json interferes with the deploy process.
At first I omitted the scripts, but then got a request to include them, which I did in v1.3.2. But then recently a user told me that the build script is being picked up by the firebase deploy pipeline, which it shouldn't really.
So I think in the next version I am going to at least create a configuration option to include/exclude the package scripts from the isolate output manifest.
Could you try to use v1.3.1, which still omits the scripts property? If that works then we know where the problem is...
Also, I wonder why you have these configurations set:
"workspaceRoot": "../..",
"workspacePackages": ["packages/*", "apps/*"],
If you are using a typical monorepo setup, I think they should not be required.
@alexeigs I've created an example that might find useful https://github.com/0x80/mono-ts
@alexeigs The spaces problem has been fixed in the latest version
Also, more importantly, isolated lockfiles are not generated for NPM and all other package managers.
I'm working with a standard turbo/yarn workspaces setup as can be found in https://github.com/vercel/turbo/tree/main/examples/with-tailwind and want to use
isolate-package
to isolateapps/functions
(firebase functions setup as outlined in the docs here).Even after I gave it several tries and went over my whole setup to make sure I'm in line with both the standard turbo/yarn workspaces as well as
isolate-package
setup, I do not manage though to understand what's going wrong when runningisolate
, so let me share some code here.First the actual error which occurs when I run
isolate
. The problem occurs with thecommon
package (the only package that is needed from ./packages/*) and it seems as the path includes some parts twice with a weird cut or missing piece where usually is a whitespace (inOwn Projects
):... the invalid path is the following:
/Users/<username>/Own Projects/<project>/packages/common/Projects/<project>/apps/functions/isolate/__tmp/package.json
which is a weird combination of/Users/<username>/Own Projects/<project>/packages/common/
andProjects/<project>/apps/functions/isolate/__tmp/package.json
where the latter path lacks the beginning and theOwn
inOwn Projects
Now let me share my setup:
./package.json:
apps/functions/package.json:
apps/functions/isolate.config.json:
apps/functions/tsconfig.json:
apps/functions/tsconfig.build.json:
packages/common/package.json:
packages/common/tsconfig.json:
packages/common/tsup.config.ts: