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.

vue + vite + pubsub issue with latest update

See original GitHub issue

Before opening, please confirm:

JavaScript Framework

Vue

Amplify APIs

PubSub

Amplify Categories

No response

Environment information

# Put output below this line
  System:
    OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa)
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 21.74 GB / 31.27 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 14.20.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 6.14.17 - /usr/local/bin/npm
  Browsers:
    Chromium: 105.0.5195.102
    Firefox: 104.0
  npmPackages:
    @vitejs/plugin-vue: ^3.0.3 => 3.1.0 
    aws-amplify: ^4.3.35 => 4.3.35 
    vite: ^3.0.9 => 3.1.2 
    vue: ^3.2.38 => 3.2.39 
  npmGlobalPackages:
    @tailwindcss/language-server: 0.0.7
    @volar/server: 0.32.1
    live-server: 1.2.2
    neovim: 4.10.1
    npm-check-updates: 15.0.5
    sass: 1.53.0
    tree-sitter-cli: 0.20.6
    tree-sitter: 0.20.0
    typescript-language-server: 0.10.1
    typescript: 4.7.2
    vscode-langservers-extracted: 4.2.1

Describe the bug

I tried to implement the Pubsub module in a project. however i had problems using it in the dev build. However, the error “AMQJS0010E WebSocket is not supported by this browser” always came up(when i run ‘npm run build’, everything works fine). Anyone have any Idea? I tried installing the seperated ws npm module, but the error persist.

So I tried to update amplify and Vite. However, this created a new error that seems to be related to the latest amplify update? https://github.com/aws-amplify/amplify-js/pull/10298

After adding this line in the Code: ‘import { AWSIoTProvider } from ‘@aws-amplify/pubsub’;’ This error comes up: ‘Uncaught TypeError: Object.setPrototypeOf: expected an object or null, got undefined’ even if you remove the line and restart the vite server, the error persists, you then have to delete the node module folder and reinstall it.

For faster investigation i reproduced the bug in a fresh vue + amplify setup: https://github.com/jens3911/vue-test

Expected behavior

Import AWSIoTProvider and use it as expected in the Doc.

Reproduction steps

npm init vue@latest npm install aws-amplify npm i

Add to main.js import { Amplify, Auth, Hub, PubSub } from ‘aws-amplify’ import { AWSIoTProvider } from ‘@aws-amplify/pubsub’;

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
stocaarocommented, Sep 21, 2022

Hello,

I’ve been troubleshooting this issue yesterday and today. I have a tested fix out for PR. I had attempted to resolve this in a prior change that solved for one of the repro cases, but not all. I have tested this change for both vue and react reproduction cases and expect it to resolve all the the vite build issues related to pubsub access.

Thanks, Aaron

1reaction
abdallahshaban557commented, Oct 1, 2022

We have now released the fix in our latest version. Please inform us if you are still facing an issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Cannot find module 'vue-loader-v16/package.json'
the problem i am facing with the vue loader didn't happened at first. but from the second time the app crashes from starting...
Read more >
Refactor issuables list to Vue, part 1 (!15091) · Merge requests - GitLab
Documentation created/updated or follow-up review issue created ... I set up a simple pub/sub system that allows the Vue component to communicate with...
Read more >
Making Nuxt.js clone with Vue 3 and Vite (Vue Custom Server ...
In Nuxt 2 we have BODY_SCRIPTS, but not in Nuxt 3 (At the time of writing article). Or i have problem what i...
Read more >
Guide to Deploy Vue.js App to Google App Engine With Cloud ...
Deployment guide for Vue.js on Google App Engine using Git and Docker. Source: Author ... Add a new repository in Google Cloud Source...
Read more >
Implement the PubSub Pattern in Vue.js | by Sang Nguyen
Unsubscribe from the topic when the component is unmounted. Provide us a reactive data to check the subscription status of a subscriber. Now,...
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