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

The server refuses to start if one of the endpoint methods is called "delete" #7460

Closed
tomivirkki opened this issue Jan 31, 2020 · 4 comments · Fixed by #7518
Closed

The server refuses to start if one of the endpoint methods is called "delete" #7460

tomivirkki opened this issue Jan 31, 2020 · 4 comments · Fixed by #7518
Assignees
Labels
bug hilla Issues related to Hilla

Comments

@tomivirkki
Copy link
Member

This makes the server refuse to start:

@AnonymousAllowed
public void delete(Location location) {

Changing the name to anything else fixes the issue and the server starts up fine:

@AnonymousAllowed
public void deleteLocation(Location location) {

Output with the issue:

2020-01-31 13:21:56.592 ERROR 25148 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Exception sending context initialized event to listener instance of class [com.vaadin.flow.spring.VaadinServletContextInitializer$DevModeServletContextListener]

java.lang.RuntimeException: Unable to initialize com.vaadin.flow.spring.VaadinServletContextInitializer$DevModeServletContextListener
        at com.vaadin.flow.spring.VaadinServletContextInitializer$FailFastServletContextListener.contextInitialized(VaadinServletContextInitializer.java:166) ~[vaadin-spring-13.0.0.alpha5.jar:na]
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4683) [tomcat-embed-core-9.0.27.jar:9.0.27]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5146) [tomcat-embed-core-9.0.27.jar:9.0.27]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.27.jar:9.0.27]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) [tomcat-embed-core-9.0.27.jar:9.0.27]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) [tomcat-embed-core-9.0.27.jar:9.0.27]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-embed-core-9.0.27.jar:9.0.27]
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [na:1.8.0_121]
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) [tomcat-embed-core-9.0.27.jar:9.0.27]
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841) [tomcat-embed-core-9.0.27.jar:9.0.27]
...
@caalador caalador added hilla Issues related to Hilla bug labels Feb 3, 2020
@caalador caalador moved this from Needs triage to P2 - Medium Priority in OLD Vaadin Flow bugs & maintenance (Vaadin 10+) Feb 3, 2020
@tomivirkki
Copy link
Member Author

tomivirkki commented Feb 3, 2020

Probably has to do with delete being a reserved word in JS

@haijian-vaadin
Copy link
Contributor

haijian-vaadin commented Feb 3, 2020

Yes, it does. I can confirm that function also does not work.

So let's document the limitation for now.

@haijian-vaadin
Copy link
Contributor

I just debug it a bit, it says so in the exception cause.
Screenshot 2020-02-03 at 11.21.49.png

@haijian-vaadin haijian-vaadin self-assigned this Feb 3, 2020
@Haprog
Copy link
Contributor

Haprog commented Feb 3, 2020

Flow seems to generate the endpoints with syntax similar to:

export function delete() {}

which won't work if the function name is a reserved word, but you can get around it by just using different syntax, so this should be fixable.

This would work just fine in ES module:

function _delete() {}
export { _delete as delete };

And it can then be called like:

import * as viewEndpoint from './my-module.js';
viewEndpoint.delete();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug hilla Issues related to Hilla
Development

Successfully merging a pull request may close this issue.

5 participants