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 log" incorrectly reports 'The projectId "x" looks incorrect' #813

Open
mgrazebrook opened this issue Oct 29, 2020 · 7 comments
Open
Assignees

Comments

@mgrazebrook
Copy link

Expected Behavior

The project ID is valid. I'm a newb so I don't know what 'clasp logs' should do.

Actual Behavior

$ clasp logs
The projectId "1Tr-yHs6iHlYxwypCeDb4Hzj9J-truncated looks incorrect.
Did you provide the correct projectID?

However this IS a valid project ID. 
> (Note: Non-breaking issues are likely not to be prioritized. Please consider a PR in addition to your issue)

Steps to Reproduce the Problem

$ clasp logs

Specifications

  • Node version (node -v): v15.0.1
  • Version (clasp -v): 2.3.0
  • OS (Mac/Linux/Windows): Mac / Darwin

Further information:

I imagine it's failing here since the ID won't match the regular expression:

clasp/src/utils.ts:227
export const isValidProjectId = (value: string) => /^[a-z][-\da-z]{5,29}$/.test(value);

My project is an Apps Script Community Connector. I'm able to push and pull. Project Properties gives no "project ID" as such, the value clasp logs quotes is the "Script ID". There is also a "Project key" but it wouldn't match this regular expression either.

To get here, I started following the Clasp Codelab but pulled my community connector instead.

@PopGoesTheWza
Copy link
Collaborator

@mgrazebrook can you suggest what the RegEx should be?

@mgrazebrook
Copy link
Author

I'm sure you know the format of project IDs better than I. However the first thing that strikes me is the regex requires [a-z] as the starting character but my ID starts with a digit. However (as noted in my description) either I'm looking for the wrong ID or the terminology (the message asks for a projectID, whereas there's no such thing in the properties), so the other possibility is that I don't know how to find the right ID and if so, perhaps the documentation could be clearer.

@sqrrrl
Copy link
Member

sqrrrl commented May 17, 2021

Looks like you're providing a script ID, not the project ID. The command needs the project ID of the underlying GCP project in order to read the logs. While this is part of the script metadata, it's not (yet) exposed in the management API.

Will update readme to be a little clearer, but no need to update the regex right now.

@sqrrrl sqrrrl closed this as completed May 17, 2021
@sqrrrl sqrrrl reopened this May 17, 2021
@sqrrrl sqrrrl self-assigned this May 17, 2021
@noahmercado
Copy link

Any update on this issue?

@marcelogaio-groovinads
Copy link

No updates? Still not working

@xEverth
Copy link

xEverth commented Jan 22, 2024

The ProjectID is the one from the associated Google Cloud Project, not the numeric one - try changing it in .clasp.json and check if it works. Hope this helps! @marcelogaio-groovinads

@PhilomathJ
Copy link

I am having this very same problem. I am a contractor within Google myself, using an internal ProjectID and receiving this error. I cloned the clasp code, extracted the regex as coded: ^[a-z][-\da-z]{5,29}$/.test(value) and ran my internal projectId through a regex tester. My ProjectId fails because it have both a period and a colon in it. But This is the actual convention of internal ProjectIds!!!

I really don't have the time to fork, modify the regex to suit my needs, then deploy locally. Please can this get what should be a really quick update?

Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants