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

Migration Guide to Parse Server 6 issues #8383

Open
4 tasks done
mman opened this issue Jan 7, 2023 · 6 comments
Open
4 tasks done

Migration Guide to Parse Server 6 issues #8383

mman opened this issue Jan 7, 2023 · 6 comments
Labels
type:docs Only change in the docs or README

Comments

@mman
Copy link
Contributor

mman commented Jan 7, 2023

New Issue Checklist

Issue 1 Description

I am following the migration guide to Parse Server 6, and encountered couple of issues.

I have changed my code to use simpler initialisation:

const ParseServer = require('parse-server');

And I get the following error:

const api = new ParseServer({...});
            ^

TypeError: ParseServer is not a constructor

I still have to use the old method of const ParseServer = require('parse-server').ParseServer; to get the proper constructor.

Issue 2 Description

Trying to start the parse server in async way via:

await api.start();

Produces the following error:

  await api.start();
  ^^^^^

SyntaxError: await is only valid in async functions and the top level bodies of modules

I have to use the following workaround to actually produce async context on top level of my index.js:

(async function main () {
  await api.start();
})();

Server

  • Parse Server version: alpha
@parse-github-assistant
Copy link

Thanks for opening this issue!

  • ❌ Please edit your post and use the provided template when creating a new issue. This helps everyone to understand your post better and asks for essential information to quicker review the issue.

@mtrezza
Copy link
Member

mtrezza commented Jan 7, 2023

SyntaxError: await is only valid in async functions and the top level bodies of modules

Which Node version are you running? await on top level is unflagged since Node 14.8.0.

@mtrezza mtrezza added the type:docs Only change in the docs or README label Jan 7, 2023
@cbaker6
Copy link
Contributor

cbaker6 commented Jan 7, 2023

SyntaxError: await is only valid in async functions and the top level bodies of modules

@mman I followed the migration guide and the directions worked for me. Your error seems to be related to how you are calling your async method. My updated code is here for reference: https://github.com/netreconlab/parse-hipaa/blob/89ccb02db7970ffd494a1dae907f9a660e117171/parse/index.js#L407-L409. I used the 6.0.0-alpha.21 image for testing my development servers, but it worked on 6.0.0-alpha.17 also.

As far as your first issue, I still used the old way as well...

@mtrezza
Copy link
Member

mtrezza commented Jan 8, 2023

@dblythy Could you take a look at @mman's issue 1?

@mman
Copy link
Contributor Author

mman commented Jan 8, 2023

@cbaker6 Looks like you are calling async function from top-level without await, and in your async function then await parse.start(). I am calling await parse.start() on the top level and that fails. Node 16.

@mman
Copy link
Contributor Author

mman commented Jan 8, 2023

SyntaxError: await is only valid in async functions and the top level bodies of modules

Which Node version are you running? await on top level is unflagged since Node 14.8.0.

@mtrezza This is happening for me on Node 16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:docs Only change in the docs or README
Projects
None yet
Development

No branches or pull requests

3 participants