Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy programmatically with option cwd doesn't work in version 4.2.1 and 5.1.1 #961

Closed
yifanyang opened this issue Oct 23, 2018 · 3 comments · Fixed by #976
Closed

Deploy programmatically with option cwd doesn't work in version 4.2.1 and 5.1.1 #961

yifanyang opened this issue Oct 23, 2018 · 3 comments · Fixed by #976
Assignees

Comments

@yifanyang
Copy link
Contributor

Version info

4.2.1 and 5.1.1

Platform Information

OS X

Steps to reproduce

Run deployment programmatically as showed in the readme file.

client.deploy({
  project: 'myfirebase',
  token: process.env.FIREBASE_TOKEN,
  cwd: '/path/to/project/folder'
}).then(function() {
  console.log('Rules have been deployed!')
}).catch(function(err) {
  // handle error
});

Expected behavior

Deployment succeeded.

Actual behavior

The above code works in version 3.19.3, but failed in 4.2.1 and 5.1.1 with below message:

TypeError: Path must be a string. Received null
    at assertPath (path.js:28:11)
    at Object.relative (path.js:1261:5)
    at Uploader.hashcacheName (/Users/yifany/Documents/experimental/performance-test/node_modules/firebase-tools/lib/deploy/hosting/uploader.js:70:29)
    at new Uploader (/Users/yifany/Documents/experimental/performance-test/node_modules/firebase-tools/lib/deploy/hosting/uploader.js:62:56)
    at _runDeploys (/Users/yifany/Documents/experimental/performance-test/node_modules/firebase-tools/lib/deploy/hosting/deploy.js:44:22)
    at module.exports (/Users/yifany/Documents/experimental/performance-test/node_modules/firebase-tools/lib/deploy/hosting/deploy.js:82:10)
    at _chain (/Users/yifany/Documents/experimental/performance-test/node_modules/firebase-tools/lib/deploy/index.js:26:38)
    at /Users/yifany/Documents/experimental/performance-test/node_modules/firebase-tools/lib/deploy/index.js:86:14
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)

It seems like the value of cwd in options does not get picked any more.

Suggested fix ?

A simple code change as below would work in my case. It could pass npm test, but not sure whether it introduces any side effect.

diff --git a/lib/deploy/hosting/deploy.js b/lib/deploy/hosting/deploy.js
index c577dc2..e8034be 100644
--- a/lib/deploy/hosting/deploy.js
+++ b/lib/deploy/hosting/deploy.js
@@ -45,6 +45,7 @@ module.exports = function(context, options) {
       version: deploy.version,
       files: files,
       public: options.config.path(deploy.config.public),
+      cwd: options.cwd,
     });
 
     var progressInterval = setInterval(function() {
@yifanyang
Copy link
Contributor Author

I have kept using version 3.19.3 as a last resort, since 4.x.x and 5.x.x doesn't work for me. But today, I got this error when trying to do a deploy with firebase-tools module.

  name: 'FirebaseError',
  message: 'HTTP Error: 410, This version of the Firebase CLI is no longer able to deploy to Firebase Hosting. Please upgrade to a newer version (>= 4.1.0). If you have further questions, please reach out to Firebase support.',

Anybody who may help look into this issue?

@bkendall
Copy link
Contributor

@yifanyang Thank you for the report. I've gone ahead and created #976 to fix this issue - your proposed solution is fine.

Older versions starting recently will return a 410 error, so you'll need to be up to at least 4.1.0, though at least 5.1.1 is recommended.

This version will land a new v6.x.x version shortly, so keep an eye out for it.

@yifanyang
Copy link
Contributor Author

Great! Thank you!

joehan pushed a commit that referenced this issue Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants