-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
firebase deploy --only functions
(at least) doesn't clean up its built lib/
folder before building.
This is most of the time not a problem but it might become one if an incorrect named file was created then deleted after the build/deploy process ended with an error.
The built version remains in the lib/
folder and same errors are still happening.
[REQUIRED] Environment info
firebase-tools: 8.4.1
Platform: macOS
[REQUIRED] Test case
Imagine that I use a Cloud function as an API with Express. For modularity and readability, I have the following structure:
src/
api.ts
files/
index.ts // this is my named exports
create.ts
read.ts
update.ts
delete.ts
And my cloud function looks like this:
import * as functions from 'firebase-functions'
import * as files from './files'
...
const app = express()
...
app.get('/file/:path', files.read)
...
Now, imagine that, in a rush, I create a files.ts
in my src/
folder. At the next deploy, I get the following Express error due to files.ts
being imported instead of files/index.ts
: Error: Route.get() requires a callback function but got a [object Undefined]
[REQUIRED] Expected behavior
If I remove my files.ts
everything should return to normal and I should build and deploy successfully.
[REQUIRED] Actual behavior
Despite the deletion of files.ts
, the lib/
folder keeps track of the built files.js
. And the deploy fails over and over.