clasp
clasp copied to clipboard
"clasp log" incorrectly reports 'The projectId "x" looks incorrect'
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.
@mgrazebrook can you suggest what the RegEx should be?
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.
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.
Any update on this issue?
No updates? Still not working
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
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