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

wixEvents.queryEventsV2 is not a function #319

Open
avoirsolutions opened this issue Jan 29, 2024 · 5 comments
Open

wixEvents.queryEventsV2 is not a function #319

avoirsolutions opened this issue Jan 29, 2024 · 5 comments

Comments

@avoirsolutions
Copy link

I am getting the following error and I am struggling to find the solution in the SDK documentation

TypeError: wixClient.wixEvents.queryEventsV2 is not a function
at Home (webpack-internal:///(rsc)/./app/page.tsx:26:45)

Has anyone come across this? Any pointers please?

Thanks

@netanelgilad
Copy link
Contributor

netanelgilad commented Jan 30, 2024

Hey @avoirsolutions,
Are you getting the error after cloning this repo? Or is that on a different project?

I just cloned the repo and ran it locally, and I'm not seeing an error. Can you add more information on how to reproduce?

@avoirsolutions
Copy link
Author

Hi @netanelgilad

I cloned the repo and it runs fine but I can't get my events to display locally even after creating a Wix Headless project with Stores and Events app, and an OAuth app (which I used for my NEXT_PUBLIC_WIX_CLIENT_ID in my env.local).

To try to find out why I couldn't see any events when loading my home page, I added a "console.log(e);" under the catch on the page.tsx as below:

let events: wixEvents.Event[] = [];
try {
events = (
await wixClient.wixEvents.queryEventsV2({
fieldset: [
wixEvents.EventFieldset.FULL,
wixEvents.EventFieldset.DETAILS,
],
query: {
paging: { limit: 10, offset: 0 },
sort: [{ fieldName: 'start', order: wixEvents.SortOrder.ASC }],
},
})
).events!;
} catch (e) {
console.log(e);
}
return (

);

The error message in the terminal is:
"TypeError: wixClient.wixEvents.queryEventsV2 is not a function
at Home (webpack-internal:///(rsc)/./app/page.tsx:28:45)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"

Any advice welcome.

Thanks

@netanelgilad
Copy link
Contributor

Did you install the repository with npm? try using yarn which should use the yarn.lock in the repository.

There's an issue with the latest version of @wix/events package, and I'm taking it internally to check what's the cause, but for now, the repo should work when using the locked versions in the yarn.lock.

@avoirsolutions
Copy link
Author

I was using
"npm i
npm run dev"
so I tried "yarn dev" and I get the same result:
"Compiled in 2.1s (910 modules)
TypeError: wixClient.wixEvents.queryEventsV2 is not a function
at Home (webpack-internal:///(rsc)/./app/page.tsx:28:45)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"

The home page loads but obvioulsy no events are loaded.

@avoirsolutions
Copy link
Author

Just a quick update to confirm that it now works and my events load on the home page. Those are the steps I took (I use Visual Studio Code btw):

  1. cloned repository again in a new folder
  2. npm install --global yarn
  3. yarn install
  4. yarn dev

the only difference from what I did before is step 2.

Thanks again @netanelgilad

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

No branches or pull requests

2 participants