Skip to content

Conversation

alan-agius4
Copy link
Collaborator

This commit updates the nguniversal migration to add REQUEST and RESPONSE tokens.

Closes #26110

…` tokens

This commit updates the nguniversal migration to add `REQUEST` and `RESPONSE` tokens.

Closes angular#26110
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: rc This PR is targeted for the next release-candidate labels Oct 30, 2023
@alan-agius4 alan-agius4 requested a review from clydin October 30, 2023 13:12
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 31, 2023
@alan-agius4 alan-agius4 merged commit 65e5331 into angular:main Oct 31, 2023
@alan-agius4 alan-agius4 deleted the tokens-express-migration branch October 31, 2023 07:59
@pavankjadda
Copy link

@alan-agius4 Whats the new package that exports these? I just ran the ng update @angular/core @angular/cli --next --force and it didn't update imports.

@pavankjadda
Copy link

@alan-agius4 did you get a chance to look at this?

@alan-agius4
Copy link
Collaborator Author

The tokens are no longer exporting from a package. Instead the migration will create them in the project when encountering imports to @nguniversal/express-engine/tokens.

@pavankjadda
Copy link

The tokens are no longer exporting from a package. Instead the migration will create them in the project when encountering imports to @nguniversal/express-engine/tokens.

Thanks. I was expecting that after looking at PR.

  1. But it's not creating them during migration
  2. When I create them manually, I see error
 error TS2742: The inferred type of 'REQUEST' cannot be named without a reference to '.pnpm/@types+express-serve-static-core@4.17.35/node_modules/@types/express-serve-static-core'. This is likely not portable. A type annotation is necessary.

export const REQUEST = new InjectionToken<Request>('REQUEST');

You can run the migration on here https://github.com/stevermeister/ngx-cookie-service and reproduce the issue

@alan-agius4
Copy link
Collaborator Author

Are you importing the Request from the right place?

import { InjectionToken } from '@angular/core';
import { Request, Response } from 'express';

export const REQUEST = new InjectionToken<Request>('REQUEST');
export const RESPONSE = new InjectionToken<Response>('RESPONSE');

@pavankjadda
Copy link

pavankjadda commented Nov 3, 2023

Are you importing the Request from the right place?

import { InjectionToken } from '@angular/core';
import { Request, Response } from 'express';

export const REQUEST = new InjectionToken<Request>('REQUEST');
export const RESPONSE = new InjectionToken<Response>('RESPONSE');

I think so. You can see them here https://github.com/stevermeister/ngx-cookie-service/blob/test/projects/ngx-cookie-service-ssr/src/lib/ssr-cookie.service.ts

@pavankjadda
Copy link

pavankjadda commented Nov 3, 2023

Are you importing the Request from the right place?

import { InjectionToken } from '@angular/core';
import { Request, Response } from 'express';

export const REQUEST = new InjectionToken<Request>('REQUEST');
export const RESPONSE = new InjectionToken<Response>('RESPONSE');

I think so. You can see them here https://github.com/stevermeister/ngx-cookie-service/blob/test/projects/ngx-cookie-service-ssr/src/lib/ssr-cookie.service.ts

It seems like an issue with PNPM. When I tried with NPM I don't see an issue. But PNPM gives that error. Any idea why?

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: rc This PR is targeted for the next release-candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New @angular/ssr is missing REQUEST and RESPONSE tokens
3 participants