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

Cannot find package '@google-cloud/firestore' imported from /app/server/chunks/2-r5tmKk85.js #1966

Open
codeBehindMe opened this issue Dec 31, 2023 · 2 comments
Assignees
Labels
api: firestore Issues related to the googleapis/nodejs-firestore API. needs more info This issue needs more information from the customer to proceed. priority: p2 Moderately-important priority. Fix may not be included in next release.

Comments

@codeBehindMe
Copy link

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

  1. Is this a client library issue or a product issue?
    This is the client library for . We will only be able to assist with issues that pertain to the behaviors of this library. If the issue you're experiencing is due to the behavior of the product itself, please visit the Support page to reach the most relevant engineers.

  2. Did someone already solve this?

  1. Do you have a support contract?
    Please create an issue in the support console to ensure a timely response.

If the support paths suggested above still do not result in a resolution, please provide the following details.

Environment details

  • OS: linux
  • Node.js version: 20
  • npm version: 9.8.1
  • @google-cloud/firestore version: 7.1.0

Steps to reproduce

  1. Create a simple svelte (ts) app and add cloud firestore.
  2. Build a docker image and run
FROM node:20 AS build

WORKDIR /app

COPY package.json ./
COPY package-lock.json ./
RUN npm install @google-cloud/firestore
RUN npm install 
COPY . ./
RUN npm run build 

FROM node:20-alpine
COPY --from=build /app/build /app
COPY --from=build /app/package.json /app
ENTRYPOINT [ "node", "/app/index.js" ]

Starting the app and visiting the URL immediately throws 500. with logs

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@google-cloud/firestore' imported from /app/build/server/chunks/2-r5tmKk85.js
at packageResolve (node:internal/modules/esm/resolve:844:9)
at moduleResolve (node:internal/modules/esm/resolve:901:20)
at defaultResolve (node:internal/modules/esm/resolve:1121:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
at ModuleWrap. (node:internal/modules/esm/module_job:85:39)
at link (node:internal/modules/esm/module_job:84:36) {
code: 'ERR_MODULE_NOT_FOUND'
}

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

@codeBehindMe codeBehindMe added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Dec 31, 2023
@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/nodejs-firestore API. label Dec 31, 2023
@MarkDuckworth MarkDuckworth self-assigned this Jan 2, 2024
@MarkDuckworth
Copy link
Contributor

This sounds like a usage question that might be specific to Svelte or Docker, I'm not seeing anything that indicates an issue with the Firestore SDK yet. Perhaps you will get better support on StackOverflow for this type of usage question.

To help isolate the issue, can you build and run your Svelte app locally without Docker?

@MarkDuckworth MarkDuckworth added needs more info This issue needs more information from the customer to proceed. and removed type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jan 2, 2024
@codeBehindMe
Copy link
Author

I see, yeah seems to be the case that I can. TBH my dev environment is devcontainers so seems to work fine with that. In fact, it works fine without the multi stage build, it's just when using the multi stage build that this fails. I've been pulled into something else, but will do a bit more experiementation and maybe hit up SO as well. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/nodejs-firestore API. needs more info This issue needs more information from the customer to proceed. priority: p2 Moderately-important priority. Fix may not be included in next release.
Projects
None yet
Development

No branches or pull requests

2 participants