google / clasp

🔗 Command Line Apps Script Projects
https://developers.google.com/apps-script/guides/clasp
Apache License 2.0
4.59k stars 428 forks source link

Clasp push does not update remote code #507

Open klevenick opened 5 years ago

klevenick commented 5 years ago

Please search existing issues before creating a new one.

DON'T DELETE THIS! FILL THESE SECTIONS OUT!

Expected Behavior

Making a change to the code and pushing it remote, it should update after a push

Actual Behavior

Pushing once does not reflect updated code, it needs a second push to be seen.

Steps to Reproduce the Problem

Specifications

Cerlancism commented 5 years ago

What I believe is the app script's site is not responsive some times(even after refresh) though internally its already updated. My trick is to only leave appscript.json open in the remote site (View -> Show Manifest File). Then use use clasp push. The .gs files should be seem updated this way when clicked on those files.

grant commented 5 years ago

@klevenick It would be useful if you gave me steps in which I can follow to see this problem. This sounds like a pretty critical problem, so I'd expect more people to run into it.

Can you add more details?

klevenick commented 5 years ago

The steps I used to recreate above are pretty much most of it. I tested it from a new project, creating it through clasp and just adding a single line to the Code.js:

var test = "test";

If I make changes locally and push, it takes two attempts for it to be updated on the apps script site's code. @Cerlancism has the trick above that seemed to work, but I wasn't able to produce reliable results, sometimes it seemed like the code reverted after publishing it.

It definitely seems like it only started in the last month, and yeah, I'm not sure why there aren't more reports. I thought it might have been something with my larger project until I started a clean one to test.

grant commented 5 years ago

OK. Maybe it's an issue with 2.0.1.

murphysprings commented 5 years ago

I've seen it on my account and had the exact symptoms described by @klevenick . I had a large project and starting in mid/late December, I pushed updates and the code wouldn't show as updated on the remote side.

clasp push Go to Google Drive. Open up App Script Project. Observe that the editor doesn't show updated code in any of the files. I can't remember if this occurred before or after I updated my clasp install; I had been on an older (maybe 1.4.1) release, then updated to 1.7.0 in December.

I've done the same thing as @klevenick to create this on a new project.

Updated to clasp 2.0.1 clasp create "Test Project" Copied over some .js files from an old project into the new project directory. clasp push Go to Google Drive. Open the App Script Project. Only see the initial Code.gs file listed; none of my other files. Even tried a clasp deploy. Opened App Script Project. It shows the deployed version, but no files besides the default Code.gs.

Also tried to eliminate browser issue, thinking it might be UBlock or a privacy setting I have in Chrome. Disabled - no change. Tried the vanilla Microsoft Edge client - same issues seeing the updated files.

Also tried to eliminate settings with my Google account. Renamed .clasprc.json clasp login to use different Google account with App Script API enabled clasp create --title "Test Project" to create project Copied over one .js file to the new project directory clasp push Open Google Drive. Open project. No .js / .gs file present - just the default.

This seems to be some issue with getting the Script Editor to load / reload the code from the updated project.

murphysprings commented 5 years ago

This has been recently reported in the App Script issue tracker: https://issuetracker.google.com/123311608

erickoledadevrel commented 5 years ago

I've been able to reproduce this behavior and have alerted the internal engineering team. I'm fairly certain that the problem lies in how the Apps Script API interacts with the script editor, so follow that issue tracker for updates.

autodonncha commented 5 years ago

Official Googleâ„¢ solution: alias clasp pushffs to clasp push && clasp push

hrzafer commented 5 years ago

Official Googleâ„¢ solution: alias clasp pushffs to clasp push && clasp push

Does that actually work?

murphysprings commented 5 years ago

running 'clasp push' twice in a row just worked for me. It's a workaround.

murphysprings commented 5 years ago

Er, I thought it was a workaround. It doesn't - running push twice still doesn't help.

Kirandeepv commented 5 years ago

@erickoledadevrel Any update on this issue, is the fix expected to come soon ?

andfletcher commented 4 years ago

@erickoledadevrel just tried using clasp but I am unable to push any changes. Is there any update on this issue? It seems like a very serious issue if people can not push changed code?

barbaraborges commented 3 years ago

I also just tried with no success :(

gerkov77 commented 3 years ago

For me clasp was working for a few deployments, then it stopped pushing the changes. When I reload the online editor, it still has the old code, If i pull the code back, I am pulling back the old code to the local project. :( [UPDATE] This was due some banal mistake I did back then. Already fixed, and clasp was working fine again, but since it was a long time ago, and working on iOS currently, I forgot the details. Probably it was about some conflicts or pushing to the wrong origin.

maxpell77 commented 2 years ago

In my case I copied the code from the Code editor (visual studio code) and pasted it into the google code editor, and then I realised there was an error on the .js . For that error I could not save the changes on google editor. So I just corrected the mistake and I could save it. That was the reason when running 'clasp push' that seems to push it well, but didn't make the changes. It just could't be saved on google just for a mistake in the code.

iamludal commented 2 years ago

Hello there! I had the same problem. I figured out this was because I had an opened tab in my browser pointing to my Apps Script project.

If you also have such a tab, try closing it and pushing the code again.

Hope this helps.

jippylong12 commented 2 years ago

I think for me I found the issue after using trying clasp version "YOUR_VERSION_STRING". I got a console message to enable API access. Once I enabled that I was able to make pushes. It's funny because I was able to clone and pull just fine.

So this is the Settings URL and then make sure that "Google Apps Script API Access" is on.

KopekDevelopek commented 2 years ago

I think for me I found the issue after using trying clasp version "YOUR_VERSION_STRING". I got a console message to enable API access. Once I enabled that I was able to make pushes. It's funny because I was able to clone and pull just fine.

So this is the Settings URL and then make sure that "Google Apps Script API Access" is on.

worked for me. thanks

viniciusknob commented 2 years ago

I had the same problem and I tried all suggestions here, but no success. So I changed the main file extension to ".gs" and clasp push worked.

mathsr190 commented 1 year ago

I had the same problem... clasp push && clasp push doesn't work. Is there any progress on this issue?

jiro2017 commented 1 year ago

I had the same problem... clasp push && clasp push doesn't work. Is there any progress on this issue?

One thing I would advise is to look at the error message you got from your CLI. That can help diagnose the problem. Before you push files you must have logged in using npm clasp login and have cloned files from your apps script using npm clasp clone to the root folder of your project. When you push files to Google Apps Script, you ought to see a pushing files message when you're done. If successful, you should able to see a list of files that are pushed from your directory as well as a message telling you your files have been pushed successfully.

To see the changes you must refresh the page of your App Script code.

davidpedrero commented 9 months ago

As @jiro2017 said, I would make sure you aren't getting any error messages in your CLI. I thought clasp push was not working because my remote editor was not updating (even though the files appeared to have been pushed successfully on my terminal). But when I scrolled up, I saw that I had a syntax error. Screenshot 2024-01-21 at 11 46 31 PM

chakaramba commented 6 months ago

Hi there Was working on extension for Google sheets and accounted a problem with cloned project when I couldn't push new changes to Apps Script via clasp.

I'm quite ashamed to spend a bit of time on it, but @davidpedrero and @jiro2017 comments here helped me: there was only an issue with access as "User has not enabled the Apps Script API". Toggling it as recommended at error message worked like a charm.

But nonetheless, I'd like to say that failing push command with error messages on the top AND a list of all project files at the bottom with closing "Pushed N files" is extremely inconvenient. CLI user will have limited height of terminal and whenever list of files exceeds this height (for me it took 7 files of 27 existing in project, for example) the only thing that he'll notice on completion of failed command is a list of all files with "Pushed" statement as if it was pushed successfully.