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

Clasp push does not update remote code #507

Open
klevenick opened this issue Jan 24, 2019 · 24 comments
Open

Clasp push does not update remote code #507

klevenick opened this issue Jan 24, 2019 · 24 comments
Assignees
Labels
API support needed A lack of a Google API feature blocks this issue

Comments

@klevenick
Copy link

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

  • Make changes to code.js, save
  • Run clasp push, confirms push
  • Reload script, change is not seen
  • Run clasp push, confirms push
  • Reload script, change is seen

Specifications

  • Node version (node -v): 11.6.0
  • Version (clasp -v): 2.0.1
  • OS (Mac/Linux/Windows): OSX 10.12.6
@Cerlancism
Copy link

Cerlancism commented Jan 25, 2019

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
Copy link
Contributor

grant commented Jan 25, 2019

@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
Copy link
Author

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
Copy link
Contributor

grant commented Jan 25, 2019

OK. Maybe it's an issue with 2.0.1.

@murphysprings
Copy link

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
Copy link

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

@erickoledadevrel
Copy link
Contributor

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.

@erickoledadevrel erickoledadevrel self-assigned this Jan 28, 2019
@autodonncha
Copy link

autodonncha commented Feb 8, 2019

Official Google™ solution: alias clasp pushffs to clasp push && clasp push

@hrzafer
Copy link

hrzafer commented Feb 10, 2019

Official Google™ solution: alias clasp pushffs to clasp push && clasp push

Does that actually work?

@murphysprings
Copy link

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

@murphysprings
Copy link

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

@grant grant added the API support needed A lack of a Google API feature blocks this issue label Mar 28, 2019
@Kirandeepv
Copy link

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

@andfletcher
Copy link

@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
Copy link

I also just tried with no success :(

@gerkov77
Copy link

gerkov77 commented May 13, 2021

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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

@jiro2017
Copy link

jiro2017 commented Mar 30, 2023

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
Copy link

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
Copy link

chakaramba commented Apr 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API support needed A lack of a Google API feature blocks this issue
Projects
None yet
Development

No branches or pull requests