CLASP Local Login - google-apps-script

I'm trying to figure out how to set up a local login file for my google scripts project in order to set it up so it'll work in an automated deploy process.
As far as I can tell, clasp login will create a file in your home directory which authenticates you with scripts.google.com, but that file isn't applicable to to local logins because it's missing some properties like "project_id".
When looking for how to create a file to run with clasp login --creds {file} there doesn't seem to be a straight forward way to generate one of those files in your local directory, which is how I would like to set up my deployment pipeline.
Most of the documentation on the internet says that you can create your own file by navigating to your GCP project and exporting a service account json file, but I don't know how to tell which GCP project my google script project is associated with.
I'm super lost, any help would be appreciated.
Thanks,
Alex

In order to log in locally I performed these steps:
In your project, make sure it's associated with a project id
(in the legacy editor > resources > cloud platform project > set your project id)
Then go to https://console.cloud.google.com/apis/credentials?authuser=0&project=your-project-id, create an Oauth2.0 clientid, and download your client secret and save it locally
From there you can locally log in by running clasp login -creds /path/to/file
Thanks to ALE13 and Error retrieving access token: TypeError: Cannot read property 'project_id' of undefined

Related

Where does the downloaded file go when execute robot framework using Jenkins

I need one help,
I am Executing a script of robot framework using Jenkins, as per the flow the script should download one XLS and validate the data using Pandas.
When I am executing the script using Jenkins and searching the downloaded file in a hardcoded path i.e. "C:\Users\Administrator\Downloads" the file is not found.
but when executing it manually the file downloaded on the same path
Can anyone please help me by telling me where do Jenkins stores all the downloaded files?
PS : I am using Google Chrome as web browser
For each job Jenkins runs, it creates a workspace directory, usually at:
$JENKINS_HOME/workspace/(Name of the Job)
The scripts (and robotframework's in this case) are run there, as the root directory. Most probably the downloaded file will be in a path from there (or an error should have occurred because the Jenkins user does not have access to the C:\Users... path).
There is a step in the Jenkins job, which is to archive (download) files from workspace, to Jenkins database, to be shown as "artifacts". Even the screenshots images or videos recording, must be registered in that step, so they can be viewed on the Report and Log in Jenkins (Robot Framework Plugin).

I cannot choose the Firebase Directory in command line

I want to host a website via Firebase hosting. When i run firebase init on cmd i get this:
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,but for now we'll just set up a default project.
i .firebaserc already has a default project, using my_project.
How can i change my project? Since I've deleted the default project that firebase mentioned, when i run firebase deploy i got this error:
Error: Failed to get Firebase project my_project. Please make sure the project exists and your account has permission to access it.
Can anyone show me the way out? Thanks.
The solution to this is very simple. All you have to do is go into your .firebaserc and change the defualt to the name of your project. You can probably also just delete .firebaserc and rerun firebase init.

Clasp Could not read API credentials. Are you logged in globally?

I'm logging in with clasp login --creds <file> which produces a local .clasprc.json file.
It says that I am logged in, but when I run another command I get:
Could not read API credentials. Are you logged in globally?
Any thoughts on why its not looking at my local clasprc file first?
Currently using version clasp v. 2.2.0
I ran into the same problem on Windows 10 and found that you need to login both globally and locally to use clasp run. There should be a .clasprc.json file in both your project folder and user folder.
I think I have finally found the solution for the same problem
Follow along with the comments from this github issue
Add the "oauthScopes" field to your local code and push it to your app
If you can't push, then copy-paste it to manifest file in the browser
Then you have to publish the app, and there were few things I've done, not sure which one helped. In the app in browser:
add the app version in File->Manage Versions
Publish -> Deploy as API executable
try to login with clasp and creds.json file
try to run something clasp run testRun
it may show the error that you're missing some oauth permissions, but it will list which ones, and you can add them
In my case, one weird thing that also helped was to enable some Google API
so in the app in browser: Resources -> Advanced Google Services -> enable some API
then try to do clasp run
if it works, you can disable the API that you have enabled previously.
Hope that helps

AWS beanstalk deployment error

I have little problems with deploying an application.
I have an PHP environment. I have uploaded an .zip file in it containing 3 files - one.php, two.html and three.html. The problem is when I click on the environment URL also on my pure domain example.com I get the following error: 
Forbidden
You don't have permission to access / on this server.
However when I type the address with its extension, for example environmentURL/one.php or example.com/one.php it works great.
Can someone help me with this please. Why I'm unable to access my app via its first primary page?
You can't access your app via primary page because your app is missing an index. Add an index file (index.php or index.html) to your zip bundle and it should work.

Unable to upload widget to Wirecloud instances in private server

We have downloaded and installed a running instance of Wirecloud in our company server following the steps at:
https://conwet.fi.upm.es/wirecloud/install
We created the instance using the --quick-start command to try the instance, and ran wirecloud using the Django internal web server with the following command:
$ python manage.py runserver 0.0.0.0:8080 --insecure
We are able to enter the instance, and move around the enviroment, but we have encountered a problem when we try to upload a widget to our local workspace. After I search for the widget in my computer (previously downloaded from the Fi-lab marketplace), we get the next message:
Error adding packaged resource: Internal Server Error.
We also tried to download the zip file of the widget from github, unzip it and recompress it as a wgt file (compress as a zip but changing the extension to .wgt) and we get the same answer from our wirecloud instance; but if we try to upload the same package to the instance in fi-lab, it uploads successfully.
We don't know if it's because of the quick-start installation we made or if we have to modify something from our widget files in order to be able to upload it to our local instance.
Solved
The problem was in the config.xml file: the name of the attributes and the structure of the widgets unable to upload were different from the template of the config.xml file posted at the users guide.
After changing it to follow the structure of the template it works fine.
My widget example was the NGSI Updater. The thing is that it uploads perfectly in the instance at FiLab, even though the config.xml file had a different structure from the one of the template; but it encounters an error when uploading it to the Wirecloud local instance at my server.