Skip to content

deploy doesn't clean up lib/ folder #2359

@crapougnax

Description

@crapougnax

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.tsbeing 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.tseverything 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions