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
🔍 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
- nuxt-use-sound Setup must use
composition-api
in project.
Docker file
FROM node:14.16.0-alpineARG 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:
- Created 2 years ago
- Comments:16 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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?
@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
orsample-vue-library
tobuild.transpile
solves this issue.