Deployments using Atlassian Firebase pipe are failing with this odd error...
Traceback (most recent call last):
File "/main.py", line 170, in <module>
pipe.run()
File "/main.py", line 69, in run
functions_dir_path = data["functions"]["source"]
TypeError: list indices must be integers or slices, not str
This failed the same way with versions 1.3.0 and 3.0.0 of the pipe "atlassian/firebase-deploy"
IIUC, here's the code block from the Atlassian code...
# check for alternative path to functions directory
try:
with open('firebase.json', 'r') as f:
data = json.load(f)
functions_dir_path = data["functions"]["source"]
except FileNotFoundError:
pass
except KeyError:
pass
It seems to be looking at our firebase.json for nodes source that is under a node functions. This doesn't seem to jive with my understanding of a firebase.json file. I don't think it even has a plural 'functions' node.
Any help is appreciated.
@Larry Johnson @tomcatbuzz @Danilo Lombardi hi.
We released a new version 3.1.1 of the firebase-deploy pipe, where the bug should be fixed.
Waiting for your feedback.
Regards, Igor
By default the pipe will use nodeJS version 16. You could change this with i.e to use nodeJS version 18 for hosting with `NODE_JS_VERSION` variable:
script: - pipe: atlassian/firebase-deploy:3.1.1 variables: KEY_FILE: $KEY_FILE NODE_JS_VERSION: '18'
Supported values are: 14, 16 (default), 18.
With `firebase deploy --only functions` command `NODE_JS_VERSION` variable has no power (you could omit it); you have the ability to use nodeJS version provided in the engines
field of the package.json
file in your functions/
directory started from nodeJS version `10`.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The pipeline is now failing saying Error: Failed to authenticate, have you run firebase login? I have the KEY_FILE: $KEY_FILE set in the settings like the docs said.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@tomcatbuzz hi. Create a new question and provide more details with your pipeline config and log output.
Have you created your KEY_FILE variable according to this article?
bitbucket-cloud/docs/use-multiple-ssh-keys-in-your-pipeline
Linux
base64 -w 0 < your_key_file
Mac
base64 < your_key_file
and then pass the result as value to Repository variables KEY_FILE
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have now generated 2 base64 encoded variables and both times they are failing. This is based on the google credential json. I think Bitbucket has over complicated the Auth method, since before we could simply use a token before <- easy. It should not take hours of trial and error to Simply have a simple deploy on push solution. This has completely ruined the past experience of pipelines. Thanks for your reply. I am moving to another platform for Deploying.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@tomcatbuzz : "since before we could simply use a token before <- easy." this method is still available.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Larry Johnson hi.
Is it possible in monorepo in different function packages.json have different node versions?
I think about fetching node version from the first element of the list of functions. Is this correct?
Or do you think it is better to just provide node version as a pipe variable NODE_VERSION?
This solutions will not support multiple node version in different function packages.
Still confusing with multiple node version support, i think this will be hard to implement, is this a real case?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It probably is unreasonable to require the pipeline to support multiple node versions. But I am no expert in any of the technologies used.
Adding a NODE_VERSION pipe variable would work for us. If it is present the pipe could skip the code trying to find node version.
I've only been looking at main.py in the MAIN branch. Unless I'm missing something, it seems line 75 always reverses whatever may be done in line 69. I'm guessing I'm not looking at the latest code.
Also, we use the pipe for firebase 'hosting' sites as well, which has worked well for us. But as I look at the main.py in the MAIN branch, I do not see how that version ever handled hosting sites.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
```It probably is unreasonable to require the pipeline to support multiple node versions. ``` we already support multiple node versions:
``` line 75 always reverses whatever may be done in line 69.``` -- thats true, this will be fixed.
I will add a little clarification about what i asking. My question was about monorepo:
$ tree .
├── firebase.json
├── teamA
│ ├── index.js
│ └── package.json
└── teamB
├── index.js
└── package.json
as you can see here is the list (your case) with two package.json present.
Content of firebase.json:
"functions": [
{
"source": "teamA",
"codebase": "team-a"
},
{
"source": "teamB",
"codebase": "team-b"
},
]
When you will run this all is ok when node version is the same (node 16 here):
$ firebase deploy --only functions
i deploying functions
i functions: preparing codebase team-a for deployment
i functions: preparing codebase team-b for deployment
i functions: creating Node.js 16 function team-a:helloATeam(us-central1)...
i functions: creating Node.js 16 function team-b:helloBTeam(us-central1)...
...
My question: is it possible to be different node version in package.json teamA and package.json teamB. And if yes, then what firebase cli will do.
Previously we don't have such cases (with monorepo), so i'm a little confused.
Anyway i will thinking about feature to provide node as a pipe variable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not an expert on Firebase or Node. But to answer as best I can...
I would think the Firebase CLI would allow multiple node versions.
But I can see where you can make it a requirement for the pipeline that all versions be the same. We're a greenfield project so this should not be a problem for us. Not so sure about other clients.
Sorry if this is no help, but don't want to pretend to be an expert.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The same error here. @Larry Johnson could you help me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Where is the place to add a NODE_VERSION? I tried at bitbucket-pipelines.yml
NODE_VERSION: '16'
but i found the same error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Danilo Lombardi , That feature has not been added. The conversation started by @Igor Stoyanov on December 27 is regarding the various possible changes that Atlassian might be making to the pipe to address this problem. In another conversatio on this same topic, Igor thinks the fix may be available in a few days or a few weeks.
I know that is no help, sorry. Hope you have a wonderful New Year.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Danilo Lombardi if it is for Functions, the node version is defined in the package.json for your functions folder. Using
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It appears that the Bitbucket Pipeline for firebase-deploy has a bug. It expects the firebase.json to have an object at the path 'functions/source', where as a monorepo will have an array in this location.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Larry Johnson . Thanks for your feedback. Yes, seems like this i bug according to your investigation. We will dive deep into this this and notify you about results.
Regards, Igor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am having the same error and keep changing deploy templates. It is failing every deploy. Well I used to love the simplicity of the deploy pipelines but obviously the new 3.0.0 is not working. And how many weeks does it take to fix this? If it gets fixed I will try again. Going to just script my own deploy for now on push.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Igor Stoyanov , Do you know when this will be resolved?
@tomcatbuzz Would you be willing to share your solution? I was thinking I'd have to resort to a Container
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@[deleted] I just have to run firebase deploy manually from the cli. If the new pipeline image 3.0.0 is failing for its Primary purpose of deploying to firebase it is useless in my opinion. I have older deploys still working with image 1.2.4 and $FIREBASE_TOKEN. The newer updates tell us to use the KEYS as of recent changes. I have not resorted to making an older template to work with TOKEN. I am not even sure it will work. If it is not FIXED soon I will USE Github Actions for Firebase Deploy. I have a project in Github using Github Actions and works like it is supposed to.
NOTE: A work around (depends on your setup) is creating a script in your package.json.
Similar to ```build: your build script```
I created this to build, commit, and deploy ```
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Larry Johnson hi. We will try to release a new version from few days to 3 weeks.
Regards, Igor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@tomcatbuzz thanks for the detail.
@Igor Stoyanov Thanks for your attention to this. We're trying to stick with Atlassian Pipelines and look forward to the new release. In the meantime, do you know of a Container Image we can use that has the Firestore CLI installed? If not, I guess we can create one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the meantime, do you know of a Container Image we can use that has the Firestore CLI installed
I don't know any official docker images for Firestore CLI.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Larry Johnson I did a search and found this repo. I don't really use docker, but this seems to be a repo that is being maintained and also listed on docker.hub. https://github.com/AndreySenov/firebase-tools-docker
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Looking at main.py in the atlassian/firebase-deploy, what good is this code at L:63
# check for alternative path to functions directory
try:
with open('firebase.json', 'r') as f:
data = json.load(f)
functions_dir_path = data["functions"]["source"]
except FileNotFoundError:
pass
except KeyError:
pass
functions_dir_path = DEFAULT_FUNCTIONS_DIR_PATH
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.