This topic was automatically generated from Slack. You can find the original thread here.
Hi,
I’m currently experiencing an issue while trying to use the google-auth package in a Pipedream Python code block. I’m attempting to import the package as described on the pipedream docs to no avail.
Below is an example of how I am importing it:
# pipedream add-package google-auth
from google.oauth2 import service_account
# pipedream add-package google-cloud-compute
from google.cloud import compute_v1
And here is the error that I get in return:
NameError
name 'service_account' is not defined
This exact code works perfectly fine locally so I’m quite confused. Any help would be much appreciated.
Hi , our team has previously attempted to use prebuilt actions and experienced issues so we tend to do logic like this through custom code blocks to ensure we have full control over them and can fix bugs swiftly without being reliant upon 3rd party tooling.
Just to clarify is this issue not possible to fix? In the documentation for magic comments GCP’s ‘Big Query’ is used as an example and authentication would be required for that as well through most likely something like google-auth which we are using so I’m slightly confused around this.
If you could check internally if there is anyway to fix the packaging issue we are running into it would be much appreciated.
Yeah for this I’ve looped in for him to aware.
Thank you for looking into this for me, this does seem to fix it.
Just a little heads up, the wording on the Magic Comments Documentation is quite confusing specifically the following bit:
When a package's name doesn't match the import name, you can install the package with the add-package comment above your imports.
The “comment above your imports” bit of text is a bit difficult to interpret and both me and another developer in our team presumed that it meant the magic comment goes above the associated import and not above all the imports. In my opinion this would make a bit more sense:
When a package's name doesn't match the import name, you can install the package with the add-package comment at the top of your codeblock.