Skip to content

Fixing extensions path recognition - #8331

Merged
joehan merged 5 commits into
masterfrom
jh-ext-delimiter
Mar 19, 2025
Merged

joehan merged 5 commits into
masterfrom
jh-ext-delimiter

Conversation

@joehan

@joehan joehan commented Mar 18, 2025

Copy link
Copy Markdown
Member

Description

Fixes #8326

@joehan
joehan requested review from CorieW, aalej and pavelgj and removed request for aalej March 18, 2025 18:35
@CorieW

CorieW commented Mar 19, 2025

Copy link
Copy Markdown
Member

Thanks for working on this issue!

Couple of things:

  1. firebase ext:install .\extension-name\ works with these changes. However, firebase ext:install ./extension-name/ stops working. Windows users tend to use both. For example, in Windows you can do things like cd ..\directory\ or cd ../directory/.
  2. I can't seem to deploy, I just keep getting this:
- create firestore-translate-text-6nab
; RESOURCE_ERROR at /deployments/firebase-ext-firestore-translate-text-6nab/resources/fstranslate: {"ResourceType":"gcp-types/cloudfunctions-v1:projects.locations.functions","ResourceErrorCode":"400","ResourceErrorMessage":"Gen1 operation for function projects/dev-extensions-testing/locations/us-central1/functions/ext-firestore-translate-text-6nab-fstranslate failed: Function failed on loading user code. This is likely due to a bug in the user code. Error message: Provided module can't be loaded.\nIs there a syntax error in your code?\nDetailed stack trace: Error: Google AI API 
key is required for Genkit Google AI translations\n    at new GenkitTranslator (/workspace/lib/translate/common.js:57:19)\n    at 
Object.<anonymous> (/workspace/lib/translate/common.js:199:30)\n 
   at Module._compile (node:internal/modules/cjs/loader:1469:14)\n    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)\n    at Module.load (node:internal/modules/cjs/loader:1288:32)\n    at Module._load (node:internal/modules/cjs/loader:1104:12)\n    at Module.require (node:internal/modules/cjs/loader:1311:19)\n    at require (node:internal/modules/helpers:179:18)\n  
  at Object.<anonymous> (/workspace/lib/translate/translateDocument.js:7:18)\n    at Module._compile (node:internal/modules/cjs/loader:1469:14)\nCould not load the function, shutting down.. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.."}

@joehan

joehan commented Mar 19, 2025

Copy link
Copy Markdown
Member Author

Thanks for working on this issue!

Couple of things:

  1. firebase ext:install .\extension-name\ works with these changes. However, firebase ext:install ./extension-name/ stops working. Windows users tend to use both. For example, in Windows you can do things like cd ..\directory\ or cd ../directory/.
  2. I can't seem to deploy, I just keep getting this:
- create firestore-translate-text-6nab
; RESOURCE_ERROR at /deployments/firebase-ext-firestore-translate-text-6nab/resources/fstranslate: {"ResourceType":"gcp-types/cloudfunctions-v1:projects.locations.functions","ResourceErrorCode":"400","ResourceErrorMessage":"Gen1 operation for function projects/dev-extensions-testing/locations/us-central1/functions/ext-firestore-translate-text-6nab-fstranslate failed: Function failed on loading user code. This is likely due to a bug in the user code. Error message: Provided module can't be loaded.\nIs there a syntax error in your code?\nDetailed stack trace: Error: Google AI API 
key is required for Genkit Google AI translations\n    at new GenkitTranslator (/workspace/lib/translate/common.js:57:19)\n    at 
Object.<anonymous> (/workspace/lib/translate/common.js:199:30)\n 
   at Module._compile (node:internal/modules/cjs/loader:1469:14)\n    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)\n    at Module.load (node:internal/modules/cjs/loader:1288:32)\n    at Module._load (node:internal/modules/cjs/loader:1104:12)\n    at Module.require (node:internal/modules/cjs/loader:1311:19)\n    at require (node:internal/modules/helpers:179:18)\n  
  at Object.<anonymous> (/workspace/lib/translate/translateDocument.js:7:18)\n    at Module._compile (node:internal/modules/cjs/loader:1469:14)\nCould not load the function, shutting down.. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.."}

To 1, TIL: https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#canonicalize-separators - I'll edit this to recognize both on windows.

To 2, that's almost certainly an unrelated issue coming from inside your code base - maybe ping the extensions team on chat for assistance if needed?

@CorieW

CorieW commented Mar 19, 2025

Copy link
Copy Markdown
Member

To 2, that's almost certainly an unrelated issue coming from inside your code base - maybe ping the extensions team on chat for assistance if needed?

I thought so too, but it did deploy when accessing the globally installed version of firebase-tools with firebase deploy. I'm having difficulty when using the local build version with npx firebase deploy. Any ideas as to why this is happening?

@joehan

joehan commented Mar 19, 2025

Copy link
Copy Markdown
Member Author

To 2, that's almost certainly an unrelated issue coming from inside your code base - maybe ping the extensions team on chat for assistance if needed?

I thought so too, but it did deploy when accessing the globally installed version of firebase-tools with firebase deploy. I'm having difficulty when using the local build version with npx firebase deploy. Any ideas as to why this is happening?

Hmmm, does it occur even if you point at the latest published version throuhg npx (ie npx firebase-tools@latest deploy)? Or just if you run against this branch (npx firebase-tools@jh-ext-delimiter deploy)?

If both those fail, my guess is that this is an unrelated issue with loading functions code when running thru npx that is showing up oddly due to poor error handling

@joehan
joehan merged commit 07356d2 into master Mar 19, 2025
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

Successfully merging this pull request may close these issues.

Backslash not working for directory location in CLI

3 participants