question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

help: ERROR Cannot read property 'observable' of undefined

See original GitHub issue

📚 What are you trying to do? Please describe. I use nuxt-use-sound for control audio files.

At first, I can’t deploy because Can't find module @vueuse/sound then I added @vueuse/sound and can deploy on Google Cloud Run but It shows ERROR Cannot read property 'observable' of undefined in the log and Server error when access to the web.

It’s working fine on local.

Images

image

image

🔍 What have you tried?

  • Add @vueuse/sound to dependencies for trying to fix the deployment problem.
  • Trying to deploy on Vercel, Got the same error but can access the web page. (Not show Server error)

ℹ️ Additional context

Docker file FROM node:14.16.0-alpine

ARG BUILD_ENV

RUN mkdir -p /usr/src/app COPY package*.json /usr/src/app/ RUN cd /usr/src/app/; npm install WORKDIR /usr/src/app COPY . /usr/src/app

RUN npm run build

CMD [ “npm”, “run”, “start” ]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
posvacommented, Mar 31, 2021

@danielroe is using build.transpile the real fix? It’s as if with commonjs modules two copies of @vue/composition-api are included when building for prod with ssr mode. I see the same problem with pinia and I think it’s because of https://github.com/nuxt-community/composition-api/blob/main/src/module/index.ts#L53. The server bundle ends up using the cjs.prod version of vue-composition api while an external library like pinia uses the cjs one.

This is fine for libraries with build modules as they can add the transpile option themselves but I think it would be beneficial to figure out a way to hint library developers on how they can solve this. Maybe an explicit error + docs?

2reactions
danielroecommented, Mar 26, 2021

@emiller12 No apology necessary, and many thanks for the reproduction. I’ll check later, but does adding your library to build.transpile make a difference?

EDIT: confirmed - adding either vue or sample-vue-library to build.transpile solves this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Observable type error: cannot read property of undefined
If you are returning an array, you can use the asyncPipe, which "subscribes to an Observable or Promise and returns the latest value...
Read more >
Cannot read property 'subscribe' of undefined - ng-mocks
This issue means that something has been replaced with a mock object and returns a dummy result ( undefined ) instead of observable...
Read more >
cannot read properties of undefined (reading 'subscribe')
AppComponent > should call app TypeError: Cannot read properties of undefined (reading 'subscribe') Inside my ngOnInit I have: this.eventsService.currentEvents.
Read more >
How to Avoid the Infamous "Cannot read properties of ... - Bitovi
That error message is telling you the function is returning undefined implicitly, but its return type does not include undefined in it. Awesome!...
Read more >
Cannot read property 'items' of null - Code with Mosh Forum
async getCart(): Promise<Observable<ShoppingCart>> { let cartId = await this. ... TypeError: Cannot read property 'key' of undefined.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found